How do you make a sprite move across the screen and have the screen move with it. A horizontly scrolling backround.
Offline
Create a background sprite. Then, try this:
forever
if <key [right arrow v] pressed?>
change x by [speed you want it to go at]
end
if <key [left arrow v] pressed?>
change x by [-speed you want it to go at]
end
clear
stamp
if <(x position) = [wherever you want it to repeat]>
set x to [-wherever you want it to repeat]
end
if <(x position) = [-wherever you want it to repeat]>
set x to [wherever you want it to repeat]
end
end
If you want it to be in an animation, do this instead:
repeat [however many times you want it to repeat]
change x by [speed]
clear
stamp
if <(x position) = [wherever you want it to repeat]>
set x to [-wherever you want it to repeat]
end
end
Last edited by skippito (2012-06-20 14:50:35)
Offline