2D Platformer: Player Movement and Animation

There are many excellent tutorials for how to get started moving a 2D player around the screen. The initial movement scheme in our game was based on this tutorial:

To create a new player, create a new scene and select CharacterBody2D as the root node. This should all be somewhat familiar if you made it through the tutorial video from the previous post: https://www.youtube.com/watch?v=m9ghnrdVgrI

You can make an engaging character with little more than a script attached to the CharacterBody2D and two child nodes: a Sprite2D and a CollisionShape2D.
– Sprite2D contains the image we want to use for our character.
– CollisionShape2D defines how our character collides with the environment.

If you look at the game you will not see a Sprite2D, but instead an AnimatedSprite2D. As the name suggests, the AnimatedSprite2D is like a Sprite2D, but animated. You can learn all about how to use an AnimatedSprite2D through either or both of the following tutorials:

  1. https://www.youtube.com/watch?v=-f1bHR0iiEY
  2. https://docs.godotengine.org/en/stable/tutorials/2d/2d_sprite_animation.html

Spritesheets are images consisting of rows and columns of individual frames of an animation. These are super useful for creating animated sprites and as of writing our project uses this free set of spritesheets: https://kenney.nl/assets/new-platformer-pack

Leave a Reply

Your email address will not be published. Required fields are marked *