Scratch Programming Playground by Al Sweigart

Scratch Programming Playground by Al Sweigart

Author:Al Sweigart
Language: eng
Format: epub, mobi
Publisher: No Starch Press, Inc.
Published: 2016-02-09T16:00:00+00:00


Click the green flag to test the code so far. Make sure the Body clones form a trail behind the snake that gets longer as the snake eats more apples. Then click the red stop sign and save your program.

6. Detect Whether the Snake Crashes into Itself or a Wall

When the snake crashes into itself or the edges of the Stage, we want to run the when I receive game over code: the Head sprite will say “Ouch!” for 2 seconds and then stop the program. Instead of writing the same code twice, let’s put the code for all crashes under a when I receive game over block so that either crash can broadcast game over and run this code. If you want to change the code, you just need to change it in one place—in the when I receive game over script.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.