Godot 4 Dev Insight: Generic Platformer - Part 03

Опубликовано: 09 Апрель 2026
на канале: bug implementer
237
8

Welcome back friend. In this part Mr Spikes is in the spotlight. We create a new scene for mr spikes and bring him to life. He gets two states. He can either sleep or chase the player if he appears near him.
We use a simple match statement for this, since we don't need an inflated state machine at this point.
let's dive right in

Music:
1. Sunset Serenade - divine
2. I've Got You - Phello
3. Airstream - Phello
4. Violet Sky (Instrumental Version) - Phello
5. Il Sole Splende - Sum Wave
6. Love to Be around You (Instrumental Version) - Love Beans

Chapters:
00:00:00 Intro
00:00:35 Import Assets
00:01:11 Create Enemy Scene
00:01:36 Prepare Animation
00:02:30 Add Collision Shape
00:03:09 Add Enemy Script
00:03:23 Add Scene To Level Template
00:04:03 Add Movement and Gravity
00:06:15 Fix Collision Layers
00:06:39 Add Player Detector
00:09:07 Implement States
00:13:07 Get Direction To Player
00:14:54 Animate Enemy