-
Check out the code in the projects below by going to the links and
pressing
Basic Game
-
The dinosaur just stays on the ground and jumps when a key is pressed to avoid random palm trees that come towards it as it runs.
-
Teaches:
-
Keeping the character on the “ground” in the game
-
Review of gravity
-
Review of cloning
-
Review of sprites moving from one edge of the screen to
the other
-
-
Apply gravity to the dinosaur.
-
Difference from the Flappy Cat game: Put an if statement
that constantly checks the y- position of the sprite. It it’s
less than the y- position of the ground, set it to the y-
position of the ground.
-
-
Make the dinosaur jump when a key is pressed.
-
Difference from the Flappy Cat game: Put an if statement
that checks if the sprite is on the ground before it jumps
so it can’t jump from mid-air.
-
-
Make the palm trees glide across the screen. This is similar to the pipes in the Flappy Cat game (refer to the instructions in Lesson 6).
-
Make the player lose when the dinosaur touches a palm tree.
Lesson 7
-
Make the feet of the dinosaur move. The dinosaur sprite has two costumes that the sprite can switch back and forth between to make it look like it's running. Sprites without running costumes can be edited with paint tools.
-
Make a score variable that counts how many times the dinosaur jumps over a palm tree. The player wins if the score reaches a certain number.
Challenges
Scratch is developed by the Lifelong Kindergarten Group at the MIT Media Lab. See http://scratch.mit.edu.
Dinosaur Game
This is parallel processing. While the dinosaur is doing all of its other actions, it's continuously switching costumes in a separate script.