Program movement?

So I’m little confused by the doco,

but whats the simplest way in Gdev 4 to program movement.

I’m attempting to program awsd as the movement keys?

After your W,A,S,D conditions, on the actions side add a force under the Movement>Add A Force. Enter in a force for the needed axis, for the axis not needed Example: W —>Add a force -100 on the Y axis, 0 on the X axis. Etc…

Cheers, I will give it a try and see how I fare.

There are three main approaches to movement:

  1. Use a built-in movement behaviour like platformer or top-down movement (and change the keys if you want)
  2. Apply a force to the player object in a particular direction, when a chosen key is pressed
  3. Adjust the X or Y position of the player object, when a chosen key is pressed

The third one is simpler if movement at a constant speed is OK, as your event is just something like:

D key is pressed | Do +4 to Player.X() to move right or

S key is pressed | Do +4 to Player.Y() to move down
Forces can give smoother movement, and movement at all sorts of angles, but there can be problems if you want to check an object has reached a particular position as forces can place the object position in between pixels. It is not so suited to tile-based movement for that reason, as you aren’t guaranteed to always align with the tiles.

Hi Matt, done this it seems to work very nicely