In GameMaker, moving a character typically involves changing their x and y coordinates on the screen. Here's a step-by-step guide to making a basic character movement system:
obj_player, initialize your movement variables.
obj_player, write the code to change the position based on player input.
obj_player to visually represent the character.
obj_player in a room and run your game to test the movement.
This is a very basic example of character movement. Depending on your needs, you might want to implement acceleration, friction, or more complex mechanics like jumping or pathfinding. Also, consider using
keyboard_check_pressed for one-time key presses and
keyboard_check_released when you want an action to occur after releasing a key.
For diagonal movement speed consistency (to avoid faster movement diagonally), you may want to normalize the speed:
Using this normalization ensures that the character moves at the same speed in all directions.
Additionally, as your game development progresses, you may want to look into finite state machines (FSM) for more complex character behaviors and better code structure and organization.