Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » IGNORE PROBLEM RESOLVED
- T-bros-coding
-
56 posts
IGNORE PROBLEM RESOLVED
IGNORE PROBLEM RESOLVED
I'm having trouble with my project, and don't know what to do.
Object of the game:
Collect the rubbish within 3 seconds of its appearance. If you catch it, you get a point. But if you don't, the waves will wash it back into the sea and you lose a point.
THE PROBLEMS:
1. No more rubbish will appear after first grab.
2. (Previous glitch that wasn't resolved) When rubbish disappears/gets washed back into the sea, no points are taken.
If you help, I promise you will be credited.
The project link: https://scratch.mit.edu/projects/823434841/
I'm having trouble with my project, and don't know what to do.
Object of the game:
Collect the rubbish within 3 seconds of its appearance. If you catch it, you get a point. But if you don't, the waves will wash it back into the sea and you lose a point.
THE PROBLEMS:
1. No more rubbish will appear after first grab.
2. (Previous glitch that wasn't resolved) When rubbish disappears/gets washed back into the sea, no points are taken.
If you help, I promise you will be credited.
The project link: https://scratch.mit.edu/projects/823434841/
Last edited by T-bros-coding (March 23, 2023 22:43:42)
- deck26
-
1000+ posts
IGNORE PROBLEM RESOLVED
Please take the time to describe the problem rather than expecting everyone willing to help to look at the project and try to work that out. You'll get more people willing to help then!
- T-bros-coding
-
56 posts
IGNORE PROBLEM RESOLVED
Okay, I'll do that. Though, the problem are quite clearly stated in the project's description. Please take the time to describe the problem rather than expecting everyone willing to help to look at the project and try to work that out. You'll get more people willing to help then!
- deck26
-
1000+ posts
IGNORE PROBLEM RESOLVED
The rubbish timer isn't getting to 3 so the script gets stuck at the wait until. It's not a good idea to increase a value by 0.1 and be checking for an integer value - computers don't store most non-integer values exactly so when you're expecting 3 the value may actually be 3.00001 fro example.
In this case it's not the exact value that's the problem but your control of the timer variable. I suspect it's being reset to 0 when it is partway through the loop that increases it 30 times. If you use the built-in timer it would be a lot easier since you don't need to increase it yourself, just reset as necessary and check for it being > 3.
In this case it's not the exact value that's the problem but your control of the timer variable. I suspect it's being reset to 0 when it is partway through the loop that increases it 30 times. If you use the built-in timer it would be a lot easier since you don't need to increase it yourself, just reset as necessary and check for it being > 3.
- T-bros-coding
-
56 posts
IGNORE PROBLEM RESOLVED
I am planning to duplicate the rubbish sprite so there's three, so the built in timer couldn't work for all of them. The rubbish timer isn't getting to 3 so the script gets stuck at the wait until. It's not a good idea to increase a value by 0.1 and be checking for an integer value - computers don't store most non-integer values exactly so when you're expecting 3 the value may actually be 3.00001 fro example.
In this case it's not the exact value that's the problem but your control of the timer variable. I suspect it's being reset to 0 when it is partway through the loop that increases it 30 times. If you use the built-in timer it would be a lot easier since you don't need to increase it yourself, just reset as necessary and check for it being > 3.
Last edited by T-bros-coding (March 23, 2023 21:46:16)
- Discussion Forums
- » Help with Scripts
-
» IGNORE PROBLEM RESOLVED