Initialize the Game

Goal: Set up the background, castle sprite, start button, and score counter.
  1. Place a "set background to" block under the "when run" block and choose the grid background.
  2. Add a "make new sprite at" block to create a castle sprite at (200, 201).
  3. Add a "make new sprite at" block to create a START button sprite at (200, 42).
  4. Add a "set size to" block to set the castle sprite size to 50.
  5. Add a "set counter to" block and set the variable counter to 0.
  6. Add a "show variable counter at" block and position it at (23, 391).
Initialize the Game

Create South Monster Function

Goal: Define a function to spawn an orange monster at the bottom moving north.
  1. Inside the "createSouthMonster" function block, add a "make new sprite at" block to create an orange monster sprite at (201, 13).
  2. Add a "set size to" block to set the orange monster size to 50.
  3. Add a "set speed to" block to set the orange monster speed to 3.
  4. Add a "sprite begins" block and attach the "moving north" behavior block to the orange monster.
Create South Monster Function

When Start Button Clicked

Goal: Start the game when the player clicks the start button.
  1. Add a "when START clicked" event block.
  2. Add a "remove" block under the event to remove the START button sprite.
  3. Add a "play sound" block and select "Digital: startup".
  4. Add the "createSouthMonster" function call block.
When Start Button Clicked

End Game Function

Goal: Define a function to handle game over when the castle is breached.
  1. Inside the "endGame" function block, add a "remove" block and select "all sprites".
  2. Add a "play sound" block and select "Alerts: playful_quirky_negative_game_cue_2".
  3. Add a "show variable counter at" block and position the counter variable at (200, 200).
End Game Function

Monster Touches Castle Event

Goal: Trigger game over when a monster reaches the castle.
  1. Add a "when orange monster touches castle" event block.
  2. Place the "endGame" function call block inside the event.
Monster Touches Castle Event

Click Monster Event

Goal: Defend the castle by clicking monsters to score points and spawn new ones.
  1. Add a "when orange monster clicked" event block.
  2. Add a "play sound" block and select "Accent: puzzle_game_accent_a_02".
  3. Add a "remove" block with "clicked orange monster" to remove the clicked monster.
  4. Add a "createSouthMonster" function call block to spawn another monster.
  5. Add a "change counter by" block and set the value to 1.
Click Monster Event

🎉 Congratulations!

Great job! You have successfully built the Defend the Castle game!
🏆

🚀 Challenge Ideas!

Ready for more? Try these challenges to level up your game!
  1. Add North, East, and West monster spawn functions so monsters attack the castle from all directions.
  2. Increase game difficulty by speeding up monsters or spawning multiple monsters as your score rises.
  3. Add a Castle Health system using a variable so the castle can take multiple hits before game over.
  4. Create a special monster type with different colors or sizes that gives bonus points or requires multiple clicks.
  5. Add a power-up spell sprite that clears all active monsters on screen when clicked.
🚀
×
Zoomed view