Page 242 - Scratch Programming Playground
P. 242

this code is very similar to the wrap-around code we
                         wrote in the Asteroid Breaker game in Chapter 8. We’ll write
                         wrap-around code for moving left and right later.





                         Save Point

                         Click the green flag to test the code so far. press the a and d
                         keys to make the cat walk up and down the slopes. If the Cat
                         sprite walks off the edge of the Ground sprite and falls to the
                         bottom of the Stage, the Cat sprite should reappear at the top.
                         then click the red stop sign and save your program.
                             this platformer has many scripts, so you might get lost
                         if you get confused. If your program isn’t working and you
                         can’t figure out why, load the project file platformer1.sb2 from
                         the resources ZIp file. Click File ► Upload from your
                         computer in the Scratch editor to load the file, and continue
                         reading from this point.





                         4. Remove the Ground Lift Delay

                         the big problem with the code right now is that the Cat sprite
                         is lifted from inside the ground to on top of it very slowly. this
                         code needs to run so fast that the player only sees the sprite
                         on top of the ground, not in it.
                             the dark purple custom blocks can help us do this. Go to
                         the More Blocks category, and click the Make a Block button.




      216   Chapter 9
   237   238   239   240   241   242   243   244   245   246   247