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

#1 2009-08-13 15:40:00

Filtaido
Scratcher
Registered: 2009-04-30
Posts: 33

Wrap sccrolling

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?


84% of teenagers own cell phones.  Add this to your signature if you like pop tarts.  tongue

Offline

 

#2 2009-08-13 15:49:53

GrammaticlyCorrect
Scratcher
Registered: 2008-11-18
Posts: 42

Re: Wrap sccrolling

No, that is not too much to ask.

Offline

 

#3 2009-08-13 16:08:11

legolover
Scratcher
Registered: 2008-03-11
Posts: 23

Re: Wrap sccrolling

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 sad  0 )y sad  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 sad  (( <{ scrollx }> <mod> 480 )) )y sad  0
<end>[/blocks]
In the second, put:
[blocks]<when green flag clicked>
<forever>
<go to x sad  (( (( <{ scrollx }> <mod> 480 )) <-> 480 )) )y sad  0
<end>[/blocks]
In the last one, put:
[blocks]<when green flag clicked>
<forever>
<go to x sad  (( (( <{ scrollx }> <mod> 480 )) <+> 480 )) )y sad  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)


Escape the Room 1! http://scratch.mit.edu/projects/legolover/291256

Offline

 

#4 2009-08-13 17:38:39

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Wrap sccrolling

You forgot to look in the obvious places
http://scratch.mit.edu/forums/viewtopic.php?id=2440
Use method 2


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#5 2009-08-14 08:05:10

yipo
Scratcher
Registered: 2008-10-05
Posts: 6

Re: Wrap sccrolling

what is warp scrolling

Offline

 

Board footer