i need help with doing scrolling backgrounds.
Offline
Try using "Forum Search" (at the top of this page) to search for
scrolling background
The topic has come up several times and a number of people have put up demo projects to show how to do it.
Offline
here is a useful forum topic for you.
http://scratch.mit.edu/forums/viewtopic.php?id=1629
Offline
Scrolling backgrounds is one of the harder things you can attempt in scratch so you should already be good at programming before trying scrolling.
Offline
For scrolling you need these things
---sprites---
9 sprites that are the size of the screen, NW, W, SW, N, centre, S, NE, E and SE
---variables---
Scroll x
Scroll y
Now for each variable do these following things, imagine you have a 9-tile system.
NW-
<when green flag clicked>
<forever>
<set x to( scroll x + 480
<set y to( scroll y + 360
W-
<when green flag clicked>
<forever>
<set x to( scroll x + 480
<set y to( scroll y + 0
SW-
<when green flag clicked>
<forever>
<set x to( scroll x + 480
<set y to( scroll y + -360
N-
<when green flag clicked>
<forever>
<set x to( scroll x + o
<set y to( scroll y + -360
Centre-
<when green flag clicked>
<forever>
<set x to( scroll x + o
<set y to( scroll y + 0
S-
<when green flag clicked>
<forever>
<set x to( scroll x + o
<set y to( scroll y + -360
NE-
<when green flag clicked>
<forever>
<set x to( scroll x + 480
<set y to( scroll y + 360
E-
<when green flag clicked>
<forever>
<set x to( scroll x + 480
<set y to( scroll y + 0
SE-
<when green flag clicked>
<forever>
<set x to( scroll x + 480
<set y to( scroll y + -360
And then for the background
<when green flag clicked>
<forever>
<if> <key[ up arrow ]pressed?>
<change{ scroll y }by( -1
<if> <key[ down arrow ]pressed?>
<change{ scroll y }by( 1
<if> <key[ right arrow ]pressed?>
<change{ scroll x }by( -1
<if> <key[ left arrow ]pressed?>
<change{ scroll x }by( 1
thats all, it's actually pretty simple, not variable mania.
there you go, the infinate scrolling is another story, so I won't get into that, but using the tip that I gave you, you might get the idea.
Last edited by JoelP (2007-10-08 01:02:47)
Offline
yeah, thanx for your help:)
Offline