In this game, one player controls a penguin, moving left and right to dodge snowballs thrown by two cloned opponents. The player uses the arrow keys to move while the opponents will automatically shoot snowballs at random intervals, with the player scoring points for every time they successfully dodge a snowball.
These are the high level steps to create this project. Try to create the project on your own first as much as possible, before checking the detailed solution samples below.
This section provides detailed, step-by-step instructions on how to build the project. There are many ways to create a project, so feel free to explore different approaches. Please note that these instructions are Al-generated, so errors may occur and the coding blocks may not map to Scratch exactly. But it should serve as very valuable references. Stay attentive as you follow along, and enjoy!
Start by creating or selecting a penguin sprite. Use the 'when green flag clicked' block to initialize the penguin's position at the bottom center of the stage. Use the 'forever' loop with 'if' statements to check for left and right arrow key presses, moving the penguin left or right accordingly.
Create a new sprite for the opponent. Use the 'when green flag clicked' block to hide the opponent sprite and set up a 'forever' loop that waits a random amount of time before creating a clone of itself. Use the 'when I start as a clone' block to make the clone visible and set its position at the top of the stage, then move it downward.
Create a variable called 'Score'. Initialize it to 0 when the green flag is clicked. Use a 'forever' loop to check if a snowball clone touches the penguin. If it does, broadcast a 'game over' message. If a snowball reaches the bottom without touching the penguin, increase the score by 1 and delete the clone.
Use the 'when I receive [game over]' block to stop all scripts, effectively ending the game. You can also add a message or sound to indicate the game is over.
Enhance the game by adding background music and sound effects for when the penguin dodges a snowball or when the game is over. Use the 'play sound' block in appropriate places in your scripts.
It is common to have bugs in the code. Here are some of issues you might run into.
Enroll your child in award-winning online Scratch coding classes led live by experts and designed by professionals from Google, Stanford, and MIT.
The challenge continues: Enjoy even more Scratch tutorials dreamed up by other students or use your imagination to make your own!
Explore your child's grade level to find computer science classes and learning pathways that set your student up for success.