Top Down Sidestep


Hello Everyone,

I'm currently working on a top down spaceship arena game whos basic gameplay plays like Asteroids except each ship has specific moves. I'd like one of the ships to have a quick sidestep in order to dodge to the left of the right without having to turn the ship.
I've been experimenting for a bit but can't seem to wrap my head around getting this to work. I've gotten the ships other moves to work but shifting the ship sideways depending on its angle is throwing me off.

If anyone can offer some advice/tip it'd be greatly appreciated



Well let's see...

You're using motion_add so I'm going to guess that you're using some simple physics a bit here...

In order to "sidestep" we'd have to find the right direction to go in. Try using the motion_add, offsetting the original image_angle by subtracting or adding 90 degrees. Probably add a substantial amount of friction to keep the "sidestep" short, I would imagine.

That's my first thought, don't feel like there's quite enough context yet...
Last edited:


Sidestep is basically just a forward movement but with its 90 degrees added to its direction


I understand I could shift the angle 90 degrees quickly, do the sidestep and then snap it back to it's original angle. But what should I do if I want the object to keep it's original angle while doing the sidestep?


Friendly Tyrant
Forum Staff
I wouldn't use motion_add for this. Use the lengthdir_x/y functions and simply add/subtract in the direction of movement for the sidestep based on the image_angle. For example:
if keyboard_check(ord("X"))

x += lengthdir_x(1, image_angle + 90);
y += lengthdir_y(1, image_angle + 90);
Then do the same for the right sidestep only subtracting 90 from the image angle. This way it won't influence the base speed and direction but will still do a "strafe" move when pressed.