Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » why: 'Forever move 10 steps' is moving faster than 'Forever move 2 steps'.
- tomliuwhite
-
99 posts
why: 'Forever move 10 steps' is moving faster than 'Forever move 2 steps'.
forever
move (10) steps
end
forever'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.
move (2) steps
end
- deck26
-
1000+ posts
why: 'Forever move 10 steps' is moving faster than 'Forever move 2 steps'.
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.forever
move (10) steps
endforever'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.
move (2) steps
end
- PutneyCat
-
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!
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
-
99 posts
why: 'Forever move 10 steps' is moving faster than 'Forever move 2 steps'.
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.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.forever
move (10) steps
endforever'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.
move (2) steps
end
- deck26
-
1000+ posts
why: 'Forever move 10 steps' is moving faster than 'Forever move 2 steps'.
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).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.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.forever
move (10) steps
endforever'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.
move (2) steps
end
- tomliuwhite
-
99 posts
why: 'Forever move 10 steps' is moving faster than 'Forever move 2 steps'.
Sounds great, 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).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.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.forever
move (10) steps
endforever'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.
move (2) steps
end
- Yeeto-
-
3 posts
why: 'Forever move 10 steps' is moving faster than 'Forever move 2 steps'.
I can understand how this may be confusing, but let's put this into a real-life scenario.forever
move (10) steps
endforever'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.
move (2) steps
end
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
-
27 posts
why: 'Forever move 10 steps' is moving faster than 'Forever move 2 steps'.
I can understand how this may be confusing, but let's put this into a real-life scenario.forever
move (10) steps
endforever'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.
move (2) steps
end
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)
- Discussion Forums
- » Help with Scripts
-
» why: 'Forever move 10 steps' is moving faster than 'Forever move 2 steps'.