The Roaming Ghost
Fix a spooky game where you collect items while avoiding a ghost.
Remix the project
Goal:
Make a copy of the project for today's lesson
Click the
LINK
to remix the project.
Fix the "when run" block
Goal:
Fix the "When run" block so that it will initialize the game environment, player, and title screen.
look at the image and see what needs to be fixed.
Tip:
Make sure to select the correct background image.
Check:
Did you see the title screen when you run the code?
Fix the createGameMap function
Goal:
Fix the 'createGameMap' function so that it will set the background and create collectible items.
Look at the image and see what needs to be fixed.
Check:
Does your function have all the sprite setup blocks, background setup, and collectible item creation inside?
Fix the createHero function
Goal:
Fix the 'createGameMap' function so that it will set the background and create collectible items.
look at the image and see what needs to be fixed.
Check:
Does your hero move correctly with the arrow keys and does not walk through the walls?
Fix the startGame function
Goal:
Fix the 'startGame' function so that it will set the background and create the hero.
look at the image and see what needs to be fixed.
Tip:
You can find the 'function' blocks in the Functions category.
Check:
Does your startGame function have all the sprite setup blocks inside?
Fix the when "Space" pressed event
Goal:
Add a 'when space pressed' block to call the 'startGame' function.
look at the image and see what needs to be fixed.
Check:
Does the game start when you press the space key?
Fix the win game function
Goal:
Create the win game function.
look at the image and see what needs to be fixed.
Tip:
Play around with different background images for your win screen!
Check:
Does the win screen appear when you win?
Fix the Timer logic
Goal:
Fix the timer logic.
look at the image and see what needs to be fixed.
Tip:
Ensure your timer resets inside the loop so it continues to count down.
Check:
Does the timer count down correctly by 1 every second?
Add logic to make collectible unstuck
Goal:
Implement the logic to make collectible sprites unstuck.
look at the image and see what needs to be fixed.
Tip:
Using 'random location' helps ensure the collectible doesn't get stuck in the same place.
Check:
Do the coins move to a new location when they spawn on a rock?
Fix logic for collecting coins
Goal:
Fix the logic for collecting coins.
look at the image and see what needs to be fixed.
Tip:
Don't forget to increase the variable by 1 every time the hero touches a coin.
Check:
Does the coin count increase when you touch a coin?
End Game Logic
Goal:
Implement the logic to end the game when the hero touches the ghost.
look at the image and see what needs to be fixed.
Tip:
Make sure your 'endGame' function removes all sprites so the game looks clean.
Check:
Does the game end and show the "Game Over" message when you touch the ghost?
🎉 Congratulations!
Congratulations! You've completed 'The Roaming Ghost' game. Time to test your skills and see how many carrots you can collect!
Celebrate!
🏆
🚀 Challenge Ideas!
Ready for more? Try these challenges to level up your game!
Add multiple lives
Make the walls move
Make enemies faster
🚀