Sunday, July 19, 2009

Games : ScrollingDemo


This example comes with Scratch 1.4 under "Games" category (Just click [File]-->[Open]-->[Examples]-->[Games]) and demonstrates how to create a "scrolling-scene". Try to run this scenario in order to know what it actually does!


There are 5 sprites: 1 for the "player" object and the other four for "terrain" objects, simulating a scrolling environment. As we can see on the script blocks above, a variable declared as "scrollX" has a vital function in this scenario. x position of the player object remains the same (doesn't change) during the program run; y coordinate might be changed if we press the up arrow key. If we press left or right arrow keys, our program will re-position terrain objects (see the four script blocks above at the right side).

No comments:

Post a Comment