GMS 2 Need help setting up player management


Edit - it really depends on what you want to accomplish in the end. A simple way to get this going is this
if (keyboard_check_pressed(vk_space)) speed = 5;
if (keyboard_check_pressed(vk_up)) direction = 90;
if (keyboard_check_pressed(vk_down)) direction = 270;
if (keyboard_check_pressed(vk_left)) direction = 180;
if (keyboard_check_pressed(vk_right)) direction = 0;
Last edited:
press space then direction key, it'll start moving. that is if you've placed the above code samples provided in the step event of the ball object, and place that object in the room.
You don't need to attach an image every time to answer a simple question.
In this case, I think it showed us the issue.

From one of your pictures, I'm assuming you're using physics. If so, you can't mix that system with the builtin variables. If you're going to use physics, you have to use the related functions.


press space nothing happens
The code works as I just copied it into an object to test it and it moved the instance as expected.

I notice on your screenshot the ball is selected in the room, but the "Background" layer is highlighted.
When you select something in the room the selected layer also changes automatically.

Have you dragged the object onto the "Instances" layer, and not the sprite onto the "Background" layer?

@BattleRifle BR55 Good eye! (But still not best practice.)

Good example of why it's better to try to describe an issue as clearly as possible:
1) What you are trying to do?
2) What actions you have taken attempting to implement (1)?
3) What is your expected behaviour?
4) What the actual behaviour?
Last edited: