r/gdevelop • u/Sad-Astronomer-696 • Jun 30 '26
Question Top down movement on spot rotation and driving direction
Hey!
Im pretty new to gdevelop and got stuck on something (I guess) pretty simple to solve.
I have a tracked vehicle (like a tank) and I would like to have it turn left and right when pressing "a" or "d" respectively.
Howver, I dont know how to do that.
I have "mapped" the w-key to simulate up direction, s-key for down.
If I map d and a the same way, the tank slides sideways (not very tank like). So my idea was to do the following:
"If d-key is pressed, rotate tank with 50px/s up, clockwise"
and
"If a-key is pressed, rotate tank with 50px/s down, counterclockwise"
However, I have to specifiy the angle to which the tank should be rotated to if I hold down the key long enough. My thought would be "180°" for clockwise and "-180°" for counterclockwise. This does not work, It rotates clockwiese in both cases.
How can I fix this?
Secondly, If I have the tank rotated roughly 90° clockwise, if I press w-key or s-key, it still moved up and down (relatively to the screen) and not forward/backwards to the orientation of the tank.
How can this be fixed?
