Set the Collision Mask to 1, 3 and 4 environment, enemies and items
The player can now interact with the environment, enemies and items
In Godot's 2D and 3D physics engines, Layers define who an object is, while Masks define what an object listens to.
Collision Layer ("What am I?"): The physics layer(s) where this specific object resides in the game world.
Collision Mask ("What do I look for?"): The physics layer(s) this object scans to detect collisions, raycasts, or overlaps.
The Golden Rule: Two objects will only collide if Object A's Mask contains at least one of Object B's Layers, OR Object B's Mask contains at least one of Object A's Layers. Only one side needs to match for a collision callback to register.
Add a Sprite2D node as a child of Player
Drag player_sheet.png to the Texture property
Set HFrames to 19
Set Frame to 7
Offset the sprite to 0, -16
This is the location of the feet
Add an AnimationPlayer node as a child of Player
Click the Animation button
Select New
Name the animation idle
Set Length to 0.4 seconds
Enable looping
IMPORTANT:
Set Update Mode to Continuous
Setting an animation track to Continuous means Godot will automatically "fill in the blanks" between your keyframes so the movement looks smooth rather than choppy. Godot will fill in the missing frames for you!
Select the Sprite2D node
Hit the keyframe next to Frame
Create the track and RESET track
Move the timeline to 0.3
Add a keyframe for Frame 10
Press the Play button in the AnimationPlayer to preview the animation
Repeat the steps above to create the rest of the animations. Use the table below as a guide.
Sunny Land Animations
Animations are also provided for crouching and climbing if you want to add those, although this can be done later depending on gameplay requirements.
Add a CollisionShape2D as a child of player
Add a New RectangleShape2D
Set Size to 11 x 22
Change the position so that the bounding box is at the characters feet