I need a little help on Y scrolling so I can make a game. It would be cool if someone could help
Offline
I'm afraid this isn't and advanced topic, it belongs in "All about Scratch"
Advanced topics cover topics on editing Scratch itself and advanced mathematics questions.
To make a y scroller, you need a variable to register the current scroll position. I usually call it "ScrollY". Next you get your first background image sprite and give it the constant script of "set Y to (scrollY)". This means it will slide up and down as the variable changes. The next background (which is 480 pixels above the first background sprite because the stage is 480 pixels high) will have the same script with a slight addition.
"set Y to (scrollY) + 1 * (480)".
With every background you go up, replace the 1 with a new number, as that number determines how far away from the first sprite they are, so the third sprite will be 2*480, the fourth 3*480 and so on.
You can use the arrow keys to increment or decrement the scroll variable or change it in some other way.
You may find that there is a white flicker between sprites as you scroll, in which case change 480 to something less like 477 so that there is a slight overlap between the sprites.
The same script can be applied along the X axis!
A more complicated version of this would allow you to only use two sprites, but I'm not going into that! I'm getting this moved to all about Scratch now, where other users may be able to expand on my post! Good luck with you game
Offline
Really? It didn't work for me.
Offline
henley wrote:
Y scrolling is the same as X scrolling, except instead of using "480" use "360" when programming the terrains.
Exactly. Oh, and you need to change the X blocks to Y blocks xD
Last edited by Jonathanpb (2011-01-13 18:05:21)
Offline