This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-01-12 17:45:21

Jirachiwishu
Scratcher
Registered: 2010-02-25
Posts: 25

Y Scrolling?

I need a little help on Y scrolling so I can make a game. It would be cool if someone could help  smile


Yay.  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile : MY MINIONS! Fear me.

Offline

 

#2 2011-01-12 18:32:47

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Y Scrolling?

I'm afraid this isn't and advanced topic, it belongs in "All about Scratch"  smile

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  smile


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#3 2011-01-12 22:48:52

kingofdallamas
Scratcher
Registered: 2010-03-07
Posts: 500+

Re: Y Scrolling?

It's the same script for scrollX.  wink


http://i853.photobucket.com/albums/ab99/Gilgamesh1192/Ninja%20Saga/ElementalJutsus2.gifhttp://i27.photobucket.com/albums/c192/BoomKaTish/GIF/thgfhgfhfhgf.gif
ハロー友だち!

Offline

 

#4 2011-01-13 16:08:55

Jirachiwishu
Scratcher
Registered: 2010-02-25
Posts: 25

Re: Y Scrolling?

Really? It didn't work for me.


Yay.  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile  big_smile : MY MINIONS! Fear me.

Offline

 

#5 2011-01-13 16:27:01

henley
Scratcher
Registered: 2008-06-21
Posts: 1000+

Re: Y Scrolling?

Y scrolling is the same as X scrolling, except instead of using "480" use "360" when programming the terrains.


"I've worked so hard for you and you give me nothing in return. Do you need help... Or do I?"

Offline

 

#6 2011-01-13 18:04:50

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

Re: Y Scrolling?

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)


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

Board footer