Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Probability issues with movement and others
- fishu4
-
100+ posts
Probability issues with movement and others
So, I have a problem where the variable only is 1 if a 1 in 7000 check is met. Though, the move block *should* only move when the 1 in 7000 is activated, but instead, it moves in so about one in two chance. Please help.
Link to project
Link to project
i really need help with this. I have never had an issue like this before. Please help.
Last edited by fishu4 (Sept. 13, 2023 15:10:58)
- -TUB-
-
100+ posts
Probability issues with movement and others
When there aren't any visible changes to the stage, scratch runs scripts as fast as possible, so the script will loop over and over until the condition in the if statement is met. This can be seen by incrementing a variable every time the forever loop runs. You will see that the loop is running much more often than 1 time per second. The only time scratch delays the loop is when the cat moves forwards, which is when the condition inside the if statement is met. The result is that the cat appears to move consistently each frame.
- HoodieGuy64
-
100+ posts
Probability issues with movement and others
Scratch is running it as fast as it can, so there's a much higher chance that the conditions are met. You can put a
block so it only runs one time per second
- Discussion Forums
- » Help with Scripts
-
» Probability issues with movement and others