Originally Posted by
Super Vegeta
You should either check for collision right after moving in every single direction, or check for collision once and then retract in all directions.
Tried that, now it is always stuck. My code looks like this now, will check that in so you can check if you can help:
Code:
if al_key[Options.binding_up]<>0 then begin MarioGO.y:=MarioGO.y-4;
if MarioGO.isColliding(OtherMarioGO) then MarioGO.y:=MarioGO.y+4;
end;
if al_key[Options.binding_down]<>0 then begin
MarioGO.y:=MarioGO.y+4;
if MarioGO.isColliding(OtherMarioGO) then MarioGO.y:=MarioGO.y-4;
end;
if al_key[Options.binding_left]<>0 then begin
MarioGO.x:=MarioGO.x-4;
if MarioGO.isColliding(OtherMarioGO) then MarioGO.x:=MarioGO.x+4;
end;
if al_key[Options.binding_right]<>0 then begin
MarioGO.x:=MarioGO.x+4;
if MarioGO.isColliding(OtherMarioGO) then MarioGO.x:=MarioGO.x-4;
end;
Bookmarks