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

#1 2012-08-14 19:19:02

destructo-serpent
Scratcher
Registered: 2012-07-25
Posts: 1000+

circular scrolling

is there a way to make sprites scroll in a circle so when you reach the last sprite theres the first one again?

Offline

 

#2 2012-08-14 19:50:41

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

Re: circular scrolling

Yes.  The code should look something like this.  If it doesn't work, we'll need more details to help you.

when gf clicked
forever
set x to ((scrollX) mod [length of scrolling]) // length of scrolling should be a constant number


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

Offline

 

#3 2012-08-15 00:24:24

destructo-serpent
Scratcher
Registered: 2012-07-25
Posts: 1000+

Re: circular scrolling

that makes the first one repeat, is there a way to make them all repeat?

Offline

 

#4 2012-08-15 04:21:18

destructo-serpent
Scratcher
Registered: 2012-07-25
Posts: 1000+

Re: circular scrolling

bump

Offline

 

#5 2012-08-15 04:31:32

northmeister
Scratcher
Registered: 2011-07-12
Posts: 1000+

Re: circular scrolling

Chanmanpartyman made a helpful tutorial about making Infinite Scrolling. I made a game, Ballon Dodge, with it.

Is that what you mean?


http://i48.tinypic.com/5a25g5.png

Offline

 

#6 2012-08-15 15:33:08

destructo-serpent
Scratcher
Registered: 2012-07-25
Posts: 1000+

Re: circular scrolling

yup thatnks  big_smile

Offline

 

#7 2012-08-15 22:23:41

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

Re: circular scrolling

destructo-serpent wrote:

that makes the first one repeat, is there a way to make them all repeat?

Even though it seems the problem is solved, I'll answer this anyway:

Yes, just offset it using subtraction.

when gf clicked
forever
set x to (((scrollX)-[offset value of sprite]) mod [length of scrolling])


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

Offline

 

Board footer