Move with the keyboard
Lesson 2 of 16 · GDev.Micro
A condition can watch the keyboard. The Right key is pressed stays true on every frame while the key is held down.
Pair it with an action that changes the X position of the Player. Since the sheet runs every frame, adding 4 pixels per frame turns into smooth movement: about 240 pixels per second.
Each direction needs its own event. Two small events are the simplest movement system you can build.
In GDevelop, X grows to the right and Y grows downward. The point (0, 0) is the top-left corner of the scene.
Make Player move right with the Right key and left with the Left key.
Do it in the browser: a real game design tool, a short mission and instant feedback. No install.
Start this lesson — free