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

#1 2011-12-26 21:05:16

MaxFlyboy
Scratcher
Registered: 2011-11-07
Posts: 100+

scrolling

A lot of people ask how to do scrolling so here is an explanation

Scrolling is basically where the main sprite (or the one you want to move across a scrolling place) does not move and the whole terrain below him moves. Here is how you do it.

If you only want side to side you do this
Make a ground sprite and set the y position so it's on the bottom. Add this script to it.

when green flag clicked
forever start
set x to scroll x (make a variable called scroll x) + 480 * 0
forever end

to move right you do this. put it under any sprite, it does not matter.

when right key pressed
change scroll x by -(how much you want to move it).

to move left just change it to left key and do a positive movement.

now put your main character somewhere and it will move.

for scrolling up and down

Make a terrain sprite and put this script under it.

when green flag clicked
forever start
set y to scroll y(make a variable called scroll y) + 480 * 0
forever end

to move up do this. put it under any sprite, it does not matter.

when up key pressed
change scroll y by -(amount you want)

to move down you just set it to down key and change scroll y by a positive number.

set the main sprite anywhere and it will move around.

http://scratch.mit.edu/projects/MaxFlyboy/2224521

here is a link to a project that is isometric (the ground is the whole screen and has scroll x and scroll y) it has more complicated moving scripts but has the same main idea.

Hope this helps.


http://cdn.voodoofilm.org/images/upload/thumb/viral-video-2011.jpg click the picture for an AMV

Offline

 

#2 2011-12-29 18:50:43

nightmarescratcher
Scratcher
Registered: 2011-10-10
Posts: 1000+

Re: scrolling

Congrats on making this.
It's very easy to do, though. xD


http://fc07.deviantart.net/fs70/f/2011/171/f/3/derpy_hooves_derp_sig_by_alicehumansacrifice1-d3jg613.png

Offline

 

#3 2012-01-02 17:14:10

Purika
Scratcher
Registered: 2011-01-26
Posts: 100+

Re: scrolling

This should be moved to All About Scratch. It´s really good though!


https://lh3.googleusercontent.com/-ZlPXbnYAtro/TxRNNopA6XI/AAAAAAAAAvY/worvlbyfCYI/s589/Purika.gif
If I was three birds, I could see myself fly below us!  big_smile

Offline

 

#4 2012-01-04 09:20:10

bananaman114
Scratcher
Registered: 2010-03-15
Posts: 1000+

Re: scrolling

Maybe you should explain how it works with multiple terrains?


the sun still shines

Offline

 

Board footer