I was thinking about making a 2d game with wrap scrolling (where as soon as the background is finished, it starts over again) without running out of background.
Is that too much to ask?
Offline
No, that is not too much to ask.
Offline
Well what I would do would be to make three identical backgrounds. Assuming you have a variable named scrollx or something like that, put this code in the player sprite:
[blocks]<when green flag clicked>
<set{ scrollx }to( 0
<forever>
<go to front>
<go to x 0 )y
whatever number you need here
<end>
<when green flag clicked>
<forever>
<if><key[ left arrow ]pressed?>
<change{ scrollx }by( 10
<end>
<if><key[ rightarrow ]pressed?>
<change{ scrollx }by( -10
<end>
<end>[/blocks]
In one background, put:
[blocks]<when green flag clicked>
<forever>
<go to x (( <{ scrollx }> <mod> 480 )) )y
0
<end>[/blocks]
In the second, put:
[blocks]<when green flag clicked>
<forever>
<go to x (( (( <{ scrollx }> <mod> 480 )) <-> 480 )) )y
0
<end>[/blocks]
In the last one, put:
[blocks]<when green flag clicked>
<forever>
<go to x (( (( <{ scrollx }> <mod> 480 )) <+> 480 )) )y
0
<end>[/blocks]
This should give you a never-ending scrolling background.
My question is: why do you need a background that repeats itself???
If you need an example project Tell me an I can make one for you.
Last edited by legolover (2009-08-13 16:10:32)
Offline
You forgot to look in the obvious places
http://scratch.mit.edu/forums/viewtopic.php?id=2440
Use method 2
Offline