Overview
Overview
We are going to be setting up our player controller. It will allow us to give it a velocity
We are going to be setting up our player controller. It will allow us to give it a velocity
input that will automatically move our player throughout the world. It will also take into account
input that will automatically move our player throughout the world. It will also take into account
grounding the player, making sure they won’t fall for any obstacles.
grounding the player, making sure they won’t fall for any obstacles.
Press the + button and add a CharacterBody2D node
Press the + button and add a CharacterBody2D node
Rename it to Player
Rename it to Player
To give our Player a Sprite model, simply drag and image from the FileSystem into the Scene
To give our Player a Sprite model, simply drag and image from the FileSystem into the Scene
Make this sprite a child of the Player node
Make this sprite a child of the Player node
and rename it to Sprite.
and rename it to Sprite.
Ensure that both the Sprite and Player nodes
Ensure that both the Sprite and Player nodes
are centered at 0 , 0
are centered at 0 , 0
We need to add a collider.
We need to add a collider.
This is the player hitbox.
This is the player hitbox.
Right-click on the Player node
Right-click on the Player node
and select Add Child Node.
and select Add Child Node.
Add a CollisionShape2D and choose the Capsule shape.
Add a CollisionShape2D and choose the Capsule shape.
Surround the Sprite with the capsule.
Surround the Sprite with the capsule.