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

#1 2013-02-11 12:23:44

firedrake969_test
Scratcher
Registered: 2012-08-08
Posts: 500+

Infinite scrolling?

I looked on the wiki, but I can't find anything about how to do infinite scrolling.


Alt of Firedrake969.

Offline

 

#2 2013-02-11 13:33:00

Sqervay
New Scratcher
Registered: 2012-10-28
Posts: 52

Re: Infinite scrolling?

What do you mean with infinite scrolling?

Offline

 

#3 2013-02-11 13:38:54

kayybee
Scratcher
Registered: 2009-12-07
Posts: 1000+

Re: Infinite scrolling?

Infinite scrolling requires the use of ()mod() I think.

Just treat each of your x number of costumes as:
1, x+1, 2x+1,...
2, x+2, 2x+2,...

So you'd have to use the modulus function.

Sorry if this description isn't good.

(which infinite scrolling do you want: a one bg? or multiple bgs?)
(or... what is your definition of infinite scrolling?)

Last edited by kayybee (2013-02-11 14:09:21)

Offline

 

#4 2013-02-11 13:54:37

Sqervay
New Scratcher
Registered: 2012-10-28
Posts: 52

Re: Infinite scrolling?

I don't understand modulo  sad

Offline

 

#5 2013-02-11 14:08:10

kayybee
Scratcher
Registered: 2009-12-07
Posts: 1000+

Re: Infinite scrolling?

Sqervay wrote:

I don't understand modulo  sad

Modulo means remainder. (5mod3 is the remainder when you divide 5 by 3. so 2. 8mod3=2, 100mod3=1, 100mod5=0, etc.)
So let's say you have 5 costumes.

If you set a variable and tell it to increase by 1 every second or so, you can also have it change costume to the set variable.
So var = 1, costume # = 1
var = 2, cost# = 2
...
var = 5, cost# = 5
var = 6, cost# = ???

There is no sixth costume so it has nothing to change to!
if you want it to change to 1, you have to do (var)mod(5)
so 6mod5=1
7mod5=2

it kinda breaks when you get to multiples of five but you can add a conditional or just change some numbers to fix it. (add one to each one, and start on 0)

this has more practical uses.
Let's say you're a spaceship. when you reach the right of the screen, you should continue going through the left.
you add 240, then mod by 480, then subtract 240.
you add/subtract because the coordinate system is origin based, so you want to get 0 on the left edge. you mod by 480 to get it's wrapped coordinate. if it's 4 too much to the right it should appear 4 right of the left edge. 484mod480=4, so that would work.

you can also do this with scrolling.

Offline

 

#6 2013-02-11 17:54:02

OrcaCat
Scratcher
Registered: 2010-06-30
Posts: 500+

Re: Infinite scrolling?

My way is the easy way, but it would not work for something with over 3 costumes of scrolling.


     Awesome music     Electrode's theme     Epic music
Bye, 1.x.  sad                             Hello, 2.x!  smile

Offline

 

#7 2013-02-11 18:19:45

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Infinite scrolling?

If you'd like to look, there'a also the infinite scrolling engine that I've made.


http://i46.tinypic.com/35ismmc.png

Offline

 

#8 2013-02-13 12:23:42

firedrake969_test
Scratcher
Registered: 2012-08-08
Posts: 500+

Re: Infinite scrolling?

Bump
It would be from a bird's-eye view--I want to turn http://scratch.mit.edu/projects/Firedrake969/2964997 into infinite scrolling.


Alt of Firedrake969.

Offline

 

#9 2013-02-13 15:13:45

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Infinite scrolling?

firedrake969_test wrote:

Bump
It would be from a bird's-eye view--I want to turn http://scratch.mit.edu/projects/Firedrake969/2964997 into infinite scrolling.

Ahhh... okay. I'll look into it, though before I do, would you rather have stamping or nine sprites?


http://i46.tinypic.com/35ismmc.png

Offline

 

#10 2013-02-13 21:49:43

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Re: Infinite scrolling?

Doesn't matter, but I'd prefer stamping.


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

#11 2013-02-16 11:38:20

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Infinite scrolling?

Okay, after altering a few scripts, here's what I've made:

Infinite Scrolling Sim Engine

I hope that this helps!


http://i46.tinypic.com/35ismmc.png

Offline

 

Board footer