About The “Wait” object glitch.


#1

Okay. About The ”wait” object glitch. You can see what that is about in one of My latest projects. I think it is that in the slower one The code has check The code in The repeat Times block more times than in The other one.


#2

Can you give a link to the project?
And welcome to the forum. If you need anything tag me @BabyButterfly


#3

#4

I saw that project! I think the best way to explain this is that there is a wait time between blocks; for example, repeating “wait 10 milliseconds” 100 times, you would have a small gap between whenever it repeats, unlike just the regular “wait 1000 milliseconds”


#5

Yeah, that was also My theory when I Made that.
Also thanks for playing My projects!


#6

No prob! I really like them, they’re fun to look at.


#7

Almost Every block has a delay after it. (Usually about 15 milliseconds.)

For example, try putting repeat 60 wait 0. It will wait at most a second.

This is because almost every block requires a certain amount of time to do what it does.

I’ll explain better later, if no one else does it. :slight_smile:


#8

The reason is that the Hopscotch Player executes the code blocks at 60 fps (frames per second). Within a single “When” 1 block will execute per frame. So each block takes about 16.7ms (1s/60) to run.

The code block after a Wait block still has to wait until the next frame even if the Wait block finishes early. What does that mean? It means your [Wait 10ms], which is less than 16.7ms, is really “Wait 1 frame”, and your [Wait 100ms] is really “Wait 6 frames”. So,

Repeat 100 x 1 frame = 100 frames (or 1.67s)
Repeat 10 x 6 frame = 60 frames (or 1s)

So the Repeat 10 [Wait 100] is actually much faster!


#9

Maybe hopscotch needs to read the code, and the wait when repeating makes it slower?
I’m not sure, I’m just trying to think why it would happen


#10

Ok that’s a better explanation


#12

Yeah just saw it, yours is a better and is the correct explanation


#13

I can assure you that the explanation I gave is correct :wink:


#14

What Petrichor and ThinBuffalo said:
One frame is about 16 milliseconds, so the one waiting for 100 will execute faster


#15

Interesting, indeed.


#16

I see you have now joined the forum.


#17

Yay!
My theory for this is just that there is a small gap between each block, and that’s why it’s slower.


#18

Kinda like a null frame where it’s just one frame of nothing happening that’s too hard to catch with the human eye?


#19

this is very interesting!
(PSSSTTT… Anyone wanna enter my competition? it’s at


)


#20

You should not revive a topic just to advertise a competition. There are mass tag lists such as the @omtl that will tag people who might be interested


#21

well, that was very rude of you, please be a bit nicer to people in future