Page 275 - Scratch Programming Playground
P. 275

this code lets the Crab sprite jump up, left, and right.
                Now let’s animate the crab’s movements. the Crab sprite
            has only two costumes, crab-a and crab-b. We’ll switch between
            these two costumes to make it look like the crab is walking.
            We can simplify the set correct costume block for the Crab
            sprite a bit.
                Modify the set correct costume code to look like the
            following:



















                Notice that the numbers in the floor of 1 + frame mod
            2 blocks have also changed. the first costume is costume 1,
            and the Crab has only two costumes, so the numbers in these
            blocks have been changed to 1 and 2.
                finally, we need to create a new script so that the crabs
            can steal apples from the player. add this code to the Crab
            sprite.







                                                           MakING aN advaNCed pLatforMer 249
   270   271   272   273   274   275   276   277   278   279   280