This game is to see how many times Roger can cross the road without getting run over.
Step 1. Start a new project and create the road scene above with at least 5 turtle shapes (cars etc) going both left and right along the road.
Step 2. Create a slider and call it speed, position it as in the picture above.
Step 3. Give each of the road turtles the instruction fd speed check and select Many Times
This will move the turtles forward an amount set by the slider called speed.
The Check instruction will be used later to check whether the turtle touches traffic.
Step 4. Hatch a new turtle and name it Roger
Give it the instruction fd speedand select Many Times
Step 5. Create a button with the instruction Run_Roger
Step 6. On the procedures page enter the Run-Roger and check procedures shown below
to Run_RogerFor this to be a proper game we need to be able to control Roger. We will creat a control panel,
Step 7. Hatch 4 more turtles giving them arrow shapes as shown in the picture above.
Step 8. Give each turtle its instruction to point Roger in the relevant direction.
For example the turtle that points straight up should have the instruction Roger, seth 0
The turtle that points to the right should have the instruction Roger, seth 90
Give the other tow arrow turtles their correct instructions.
Now we need to make Roger return to the other side of the road and make the game a bit harder by speeding it up each time Roger crosses the road.
Step 9. Give Blue the instruction Roger, setpos [0 -100] setspeed speed + 1
Run_Roger should now work, however we can add a few more refinements.
When Roger gets run over he should go splat and change shape. We can also add a HighScore page to keep a record of the highest score recorded.
Step 10. Change the check procedure to:
to check
if touching? who "Roger [splat]
end
Step 11. Add the splat procedure
to splat
Roger, setsh "FlatRoger
announce [Game Over]
if speed > HighestScore [announce [A new high score] setHighestScore speed]
stopall
end
Step 12. Create a new turtle shape and call it FlatRoger
Step 13. Name the current page OK
Step 14. Add a New Page and call it HighScore
Step 15. On the HighScore page add a text box named HighestScore and type in the number 0 You can change the Font size and add some nice headings (in another text box)
Step 16. Add a button with the instruction OK on the HighScore
page to return to the game page (called OK). Add a button on the OK page with
the instruction HighScore to go to the HighScore page.
TEST YOUR GAME