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

#1 2012-06-20 14:29:52

purplepickle
New Scratcher
Registered: 2012-04-14
Posts: 6

horizontly scrolling backround

How do you make a sprite move across the screen and have the screen move with it. A horizontly scrolling backround.

Offline

 

#2 2012-06-20 14:45:42

skippito
Scratcher
Registered: 2012-03-17
Posts: 100+

Re: horizontly scrolling backround

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

 

Board footer