I want to creat a game that envolves scrolling but I do not know how to do it!Can anyone help?
Offline
Archmage has a tutorial on it.
Offline
In the sample projects in Scratch, there is a great scroller that demonstrates the basic principles of scrolling. It is called ScrollingDemo. (Number 8 in the sample games folder.)
Scrollers have background sprites the size of the stage. (You can make the scrolling background with just two sprites, but it's easiest to just make a sprite for each part of the background.)
You'll need a [scrollx] variable. Have each background sprite go to the x position of the scrollx, plus 480 times their number. (The first background to be shown will be number 1, second background will be number two, and so on.) The script for the first background will look like this:
It's also important to have a sensor sprite. it will look like this:
What's key is the sides, each of which is a different color. (You can adjust size based on your needs.) This allows you to tell it to move differently based on which side (represented by color) is touching something.
The sensor controls all movement of the player sprite, which just infinitely goes to the position of the sensor sprite. (Make sure to set the ghost effect on the sensor sprite to 100; this will hide it, but keep the sprite active, allowing it to function as normal.)
Hope this helps!
Last edited by Harakou (2010-07-09 16:53:44)
Offline
I made a tutorial project on scrolling here... it's not the best method, but it's rather simple.
Offline