Attach a new Script to your Player node

DELETE the generated code and leave only the first line.

Set up your variables

Use the function PHYSICS PROCESS. This checks code every frame at a consistent rate. 

Apply gravity by checking if the player is NOT on the floor. 

Then change vertical velocity by our gravity variable.

MULTIPLYING BY DELTA CONVERTS A per frame ACTION INTO A per second ACTION.

Setup horizontal movement




Here we set the horizontal velocity to 0.

Then we change x negatively when we want to move left

We change x positively when we want to move right.

FInally, apply the velocity using the move_and_slide function.

This function allows the player to slide up and down ramps and not get stuck.

Save the script and return to the scene view. The game has no camera so we must add one.

Make the Camera a child of the Player so that it follows the Player

Zoom in a bit by changing the zoom property



Click on Add Element

To collide with the ground we must change the properties of the TileMap

In the Tiles tab, choose TileSet, Select Paint Tool and switch to the Physics Layer 0 we just added.

Now paint all of the tiles which you want to be solid with the left mouse button.

Testing the Game

Add jumping