Page 253 - Scratch Programming Playground
P. 253

If the cat is moving up, the change y by -1 block makes the
            cat look like it’s bumping its head. otherwise, the script behaves
            as it did previously, raising the cat so it sits above the ground.
                Next, we have to edit the handle ground call in this script.
            We’ll add a Boolean condition to determine whether the sprite
            is moving up, which is y velocity > 0.























                the handle ground y velocity > 0 block sets the moving
            up input to true if the y velocity is greater than 0 (that is, if the
            sprite is jumping and moving up). If y velocity is not greater
            than 0, then the sprite is either falling down or still, causing
            the moving up input to be set to false.



                                                           MakING aN advaNCed pLatforMer 227
   248   249   250   251   252   253   254   255   256   257   258