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

#1 2013-04-19 16:08:45

spyinapie
New Scratcher
Registered: 2013-03-29
Posts: 1

Scrolling

I have a game a bit like doodle jump and i want the screen to scroll. i have a variable called scrolly and have practically finished the game, i just need a script which will scroll up when the sprie gets to the top! An Help?????

Offline

 

#2 2013-04-20 01:38:04

cauzality
New Scratcher
Registered: 2013-03-19
Posts: 44

Re: Scrolling

you could give each sprite a variable specific to that sprite; it would be it's Y position except it will not be its position on the screen, it will be its position in the world.

Every sprite will need something like this:

set [yPos v] to [some number]

when gf clicked
forever
   if < ([abs v] of ((yPos) - (scrolly)) ) < ((180) + ((WidthOfSprite) / [2])) >
      go to x: (x position) y: ((yPos) - (scrolly))
      show
   else
      hide
      end
then all you have to do is set for every sprite a yPos value and set where the scrolly is with controls or triggers.

Offline

 

Board footer