I have seen users like AB3 and Wes64 use this, but I don't understand the mechanics. I know it has to do with stamping, but I don't know how to program it. Can someone help?
Thanks!
Offline
Okay, you're going to need a variable called xscroll for the scrolling amount. Then, you need to do this:
That's a very basic 2-background scroller. If you want it to be longer, I'll post a solution to that.whenclicked
hideThe stamping will do all of the work.foreverclearRemove all previous stamps or pen marks.ifkeyandleft arrow ▼pressed?scrollx<0changescrollx ▼by1You can change this to 2, 3, 4, or 6.ifkeyandright arrow ▼pressed?scrollx>-480Limits scrolling to 480 pixels, or 2 backgrounds.changescrollx ▼by-1The same as above, but negative.switch to costumecostume1 ▼The first background.ifscrollx<480If the first background will be in the screen.go to x:scrollxy:0stampswitch to costumecostume2 ▼The second background.ifscrollx>0If the second background will be in the screen.go to x:y:scrollx+480*10stamp
Offline
berberberber wrote:
Could you tell me how to extend it?
Okay!
You start with this:
Okay, now, the first one's scripts:whenclicked
hideforeverclearifkeyandleft arrow ▼pressed?scrollx<0changescrollx ▼by1You can change this to 2, 3, 4, or 6.ifkeyandright arrow ▼pressed?scrollx<960Set this number to ((your amount of backgrounds minus 1) times 480)changescrollx ▼by-1The same as above, but negative.
Add that at the end of the forever loop.switch to costumecostume1 ▼Your first background.ifscrollx<-480go to x:scrollxy:0stamp
No, finally, for the last one. Just add this to the end of the forever loop:switch to costumecostume2 ▼Set this to the correct one.ifandscrollx<0scrollx>-960Change these numbers by -480 for each background.go to x:y:scrollx+480*10Change the 1 by 1 for each background.stamp
All done! I'm sorry if I didn't explain it well. I hope this helps!switch to costumecostume3 ▼Your last background.ifscrollx>-480Set this to (((amount of backgrounds minus 1) times 480) times -1)go to x:y:scrollx+480*20Set the 2 to the amount of backgrounds - 1.stamp
Last edited by SciTecCf (2012-06-17 13:47:47)
Offline
If you want to extend it into infinite, you should use the "mod" block. Basically, the mod block gives you the remainder after dividing the first number by the second. You have to think about it a bit before it makes sense:
-you want 2 stamps/positions.
-each one must be able to travel from one side to the other and then loop around
next, get into the math:
-since each scene is a full screen (480 pixels long) and the screen is 480 pixels long, in order for it to completely exit the screen on both sides, it must travel from x=480 to x=-480
-480*2=960 is thus the number we will use for the modulus or mod block.
so far we have:
but this will make our sprite travel from 960 to 0 and then loop back to 960, so we have to make it:go to x:y:scrollxmod9600
instead.go to x:y:-scrollxmod9604800
should do the trick.go to x:y:-modscrollx+4809604800
Last edited by AtomicBawm3 (2012-06-17 15:34:46)
Offline
berberberber wrote:
Thanks, but could you sho me the whole script, AB3?
Sure:
This is what I used for Dark and Light.whenclicked
setsx ▼to0foreverswitch to costumego to x:y:-mod+sx*-14809604800stampswitch to costumego to x:y:-modsx*-19604800stamp
Last edited by AtomicBawm3 (2012-06-17 16:38:29)
Offline
Is it something like this?
And then you just do as many costumes and sensing scripts as you need?Whenclicked
foreverswitch tocostume 1 ▼go to x:cos1 xy:cos1 ystampifchangecos1x ▼by1ifchangecos1 yby-1
Offline