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

#1 2011-11-02 18:49:03

wildwildcat
New Scratcher
Registered: 2011-06-01
Posts: 7

help with infinite scroll

i'm trying to make a doodle jump game, but i do not want to keep making sprites (platforms) for my character to jump on. do you know how to make an infinte scroller that reuses sprites?

Offline

 

#2 2011-11-02 19:17:38

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: help with infinite scroll

The key is using "modulus".  The actual block name is < () mod () > and it is in the operators.  Basically, it tells you the remainder of a division problem.  For example, 5%2=1, because 2 goes into 5 twice, with one left over (2*2+1=5).  The key to snapping a sprite to the opposite side of the screen is to set their x-position using the modulus block.  There isn't a concrete formula really, but the forumla should look something like this:

set x to ( (x + (some number) ) mod 360 ) + some number )

As a sort of disclaimer, I've never done this before, but if I were to do this, that is how I would do so.

Last edited by MoreGamesNow (2011-11-02 19:17:48)


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#3 2011-11-02 19:20:12

wildwildcat
New Scratcher
Registered: 2011-06-01
Posts: 7

Re: help with infinite scroll

thank you will try . however, will this work for y scrolling too?

Offline

 

#4 2011-11-02 20:00:54

ARANDOMACCOUNT
Scratcher
Registered: 2011-01-22
Posts: 2

Re: help with infinite scroll

What you might want to do, is create a set of them, and then set it to when it reaches the bottom, go to the top. Just program it so that when it hits a specific color, it reacts, and reuse the blocks like that.
Hope this helps!

Offline

 

#5 2011-11-02 20:16:22

Greatdane
Scratcher
Registered: 2007-06-05
Posts: 1000+

Re: help with infinite scroll

@ARANDOMACCOUNT:
Great idea! I was about to suggest that. You could also make the new blocks pop up in random y places.

@wildwildcat:
Yes, it will.
Here are some projects to get you started on how some people do this:
http://scratch.mit.edu/projects/blizzari/1647212
http://scratch.mit.edu/projects/Mrpsau/2042558
http://scratch.mit.edu/projects/TheSaint/788200

Last edited by Greatdane (2011-11-02 20:16:56)


The future belongs to those who believe in the beauty of their dreams.
        ~ Eleanor Roosevelt

Offline

 

#6 2011-11-02 21:39:22

wildwildcat
New Scratcher
Registered: 2011-06-01
Posts: 7

Re: help with infinite scroll

thank you! will try!

Offline

 

#7 2011-11-02 21:53:22

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: help with infinite scroll

Sorry, my previous post had a mistake.  It should have said "mod 480", mot "mod 360".  "mod 360" should work for y though.  Additionally, you should understand that the platform would just cycle through the screen with the same x and y, changing the x and y positions of the platforms in regards to "real x" would be trickier with script.  I'd recommend just changing the costume centers.


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#8 2011-11-02 21:56:55

wildwildcat
New Scratcher
Registered: 2011-06-01
Posts: 7

Re: help with infinite scroll

cananyone show with blocks, i might get a slight better understanding, thanks!

Offline

 

Board footer