Discuss Scratch

tomliuwhite
Scratcher
99 posts

why: 'Forever move 10 steps' is moving faster than 'Forever move 2 steps'.

forever
move (10) steps
end
forever
move (2) steps
end
'Forever move 10 steps' definitely is moving faster than ‘Forever move 2 steps’. But anyone can explain to me why? because both keep moving forever.
deck26
Scratcher
1000+ posts

why: 'Forever move 10 steps' is moving faster than 'Forever move 2 steps'.

tomliuwhite wrote:

forever
move (10) steps
end
forever
move (2) steps
end
'Forever move 10 steps' definitely is moving faster than ‘Forever move 2 steps’. But anyone can explain to me why? because both keep moving forever.
But Scratch has to refresh the screen for you to see movement. It does this approximately 30 times a second so assuming no other scripts are slowing things down this is equivalent to either moving 300 or 60 steps a second.
PutneyCat
Scratcher
500+ posts

why: 'Forever move 10 steps' is moving faster than 'Forever move 2 steps'.

The “forever” just means that the loop continues forever.

If you move 10 steps at a time you will obviously go faster than if you move 2 steps at a time.

In each case, Scratch will move the sprite about 30 times per second, by the specified number of steps in each case.

(Whether it's precisely 30 or some smaller number doesn't matter, the point is that it will be the same for both loops.)

So on that basis the first loop will move the sprite at 300 steps per second, and the second loop at 60 steps per second.

Edit: ninja'd!

Last edited by PutneyCat (Sept. 2, 2020 08:17:43)

tomliuwhite
Scratcher
99 posts

why: 'Forever move 10 steps' is moving faster than 'Forever move 2 steps'.

deck26 wrote:

tomliuwhite wrote:

forever
move (10) steps
end
forever
move (2) steps
end
'Forever move 10 steps' definitely is moving faster than ‘Forever move 2 steps’. But anyone can explain to me why? because both keep moving forever.
But Scratch has to refresh the screen for you to see movement. It does this approximately 30 times a second so assuming no other scripts are slowing things down this is equivalent to either moving 300 or 60 steps a second.
That makes sense. where did you get this knowledge?: ‘But Scratch has to refresh the screen for you to see movement. It does this approximately 30 times a second’. Any good resources about Scratch to recommend? Thanks.
deck26
Scratcher
1000+ posts

why: 'Forever move 10 steps' is moving faster than 'Forever move 2 steps'.

tomliuwhite wrote:

deck26 wrote:

tomliuwhite wrote:

forever
move (10) steps
end
forever
move (2) steps
end
'Forever move 10 steps' definitely is moving faster than ‘Forever move 2 steps’. But anyone can explain to me why? because both keep moving forever.
But Scratch has to refresh the screen for you to see movement. It does this approximately 30 times a second so assuming no other scripts are slowing things down this is equivalent to either moving 300 or 60 steps a second.
That makes sense. where did you get this knowledge?: ‘But Scratch has to refresh the screen for you to see movement. It does this approximately 30 times a second’. Any good resources about Scratch to recommend? Thanks.
I learned that by helping out here. Not sure if there is a resource that covers these things but you could check the wiki (link down below).
tomliuwhite
Scratcher
99 posts

why: 'Forever move 10 steps' is moving faster than 'Forever move 2 steps'.

deck26 wrote:

tomliuwhite wrote:

deck26 wrote:

tomliuwhite wrote:

forever
move (10) steps
end
forever
move (2) steps
end
'Forever move 10 steps' definitely is moving faster than ‘Forever move 2 steps’. But anyone can explain to me why? because both keep moving forever.
But Scratch has to refresh the screen for you to see movement. It does this approximately 30 times a second so assuming no other scripts are slowing things down this is equivalent to either moving 300 or 60 steps a second.
That makes sense. where did you get this knowledge?: ‘But Scratch has to refresh the screen for you to see movement. It does this approximately 30 times a second’. Any good resources about Scratch to recommend? Thanks.
I learned that by helping out here. Not sure if there is a resource that covers these things but you could check the wiki (link down below).
Sounds great, thanks!
Yeeto-
Scratcher
3 posts

why: 'Forever move 10 steps' is moving faster than 'Forever move 2 steps'.

tomliuwhite wrote:

forever
move (10) steps
end
forever
move (2) steps
end
'Forever move 10 steps' definitely is moving faster than ‘Forever move 2 steps’. But anyone can explain to me why? because both keep moving forever.
I can understand how this may be confusing, but let's put this into a real-life scenario.

Let's say two people are walking forward forever, assuming they can do so. One person can move at 2 steps a second while the other one can move only 1 step a second. Who will be further ahead in 5 minutes? The person walking 2 steps a second.
Yes, they will be moving forever, but at a finite pace. This means that, no matter how fast someone is moving, they will have to be at a spot X steps away from their previous spot.

Now if we switch the numbers around so that they are moving an infinite amount of steps for X seconds, then, in that case, they would be moving at the same speed and, no matter how long they move, they will be at the same “spot”, to my knowledge (but moving infinitely means there's no “previous” and no “next” spot, it just makes it easier to understand if phrased that way, in my case.)
S_w0Lf
Scratcher
27 posts

why: 'Forever move 10 steps' is moving faster than 'Forever move 2 steps'.

Yeeto- wrote:

tomliuwhite wrote:

forever
move (10) steps
end
forever
move (2) steps
end
'Forever move 10 steps' definitely is moving faster than ‘Forever move 2 steps’. But anyone can explain to me why? because both keep moving forever.
I can understand how this may be confusing, but let's put this into a real-life scenario.

Let's say two people are walking forward forever, assuming they can do so. One person can move at 2 steps a second while the other one can move only 1 step a second. Who will be further ahead in 5 minutes? The person walking 2 steps a second.
Yes, they will be moving forever, but at a finite pace. This means that, no matter how fast someone is moving, they will have to be at a spot X steps away from their previous spot.

Now if we switch the numbers around so that they are moving an infinite amount of steps for X seconds, then, in that case, they would be moving at the same speed and, no matter how long they move, they will be at the same “spot”, to my knowledge (but moving infinitely means there's no “previous” and no “next” spot, it just makes it easier to understand if phrased that way, in my case.)

This analogy also works for repeat blocks, just the people walk a finite number of seconds. More importantly, it also works for repeat blocks without anything in them:

repeat (30)
// waits 30 frames with no extra delay -> converts to 1 second assuming no lag
end

I'll assume you've read the other comment explaining that scratch refreshes the screen 30 times per second. Each “refresh” is called a frame. The repeat block above with nothing inside is the same as a person doing nothing for 30 seconds, meaning it's effectively just a better wait block, since wait blocks have an inbuilt +1 frame delay while repeat blocks don't.

wait (1) secs // actually waits 1 real-life second + 1 frame delay -> converts to 1.03 seconds assuming no lag

Last edited by S_w0Lf (Sept. 27, 2023 11:04:06)

Powered by DjangoBB