Scene setup
Start with KinematicBody2D with three children: Sprite, AnimationPlayer, and CollisionShape2D. Save the scene as Enemy.tscn in a new folder called enemies. If you decide to add more enemy types to the game, you can save them all here.
Set the body's collision layer to enemies and its collision masks to environment, player, and enemies. It's also useful to group the enemies, so click on the Node tab and add the body to a group called enemies.
Add the res://assets/opossum.png sprite sheet to the Sprite's Texture. Set Vframes to 1 and Hframes to 6. Add a rectangular collision shape that covers most (but not all) of the image, making sure that the bottom of the collision shape is aligned with the bottom of the image's feet:
Add a ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access