Page 250 - Scratch Programming Playground
P. 250

Save Point

                         Click the green flag to test the code so far. press the W key
                         to jump. Quickly pressing the key should cause a small jump.
                         holding down the W key should cause a higher jump. Make
                         sure the cat can jump only while it’s on the ground and can’t
                         do double jumps. then click the red stop sign and save your
                         program.
                             If you’re lost, open platformer4.sb in the resources ZIp file
                         and continue reading from this point.




                           D     add ceiling detection


                         the cat can walk on the ground, and now walls will stop the
                         cat from moving through them. But if the player bumps the
                         Cat sprite’s head against a platform from below, the Cat sprite
                         will rise above it! to solve this problem, we need to make some
                         adjustments to the lifting code to add ceiling detection.

                         7. Add a Low Platform to the Ground Sprite

                         add a short, low platform to the Ground sprite’s costume, as
                         shown in the following figure. Make sure it is high enough for
                         the cat to walk under but low enough that the cat can jump up
                         and touch it.

























      224   Chapter 9
   245   246   247   248   249   250   251   252   253   254   255