Part 4: Conditionals, Variables & RPG Mechanics 🎲
Description: Welcome to Part 4! Today, we are adding "Game Brains" to our project. We are using Variables and If/Else Logic to create a system where your choices actually change how the game feels.
🧠 WHAT WE ARE LEARNING:
Functions: How to "tidy up" your code by grouping the Intro Sequence into a single block called Start.
Enemy AI: Creating an "Influencer" sprite that constantly follows you using the Follow block.
The Overlap Event: Triggering a conversation when the Influencer catches you.
Risk & Reward:
If you Buy: Lose 1 Life (Health goes down).
If you Pass: Gain 1 Life + Score Points + Destroy the Enemy.
Dynamic Difficulty: Using a Forever loop to change your Player Speed based on your Health (e.g., Low Health = Slower Movement).
💡 CODING TIP: If you get an error saying "Variable myEnemy is never assigned," check your block order! You must create the sprite before you tell it to follow something.