My balloon pop game operates almost perfectly, but when a balloon is popped on the most left and upper part of the screen, the score doesn’t go up.
Please help!
My balloon pop game operates almost perfectly, but when a balloon is popped on the most left and upper part of the screen, the score doesn’t go up.
Please help!
If there are no other events besides the ones on your screenshot, the only thing I can think of is the “Trigger once”. I’ve read on some posts that “trigger once” doesn’t work well with “for each”. I don’t really know the working mechanics about it, though I did also have experienced issues when putting trigger once under a for each condition.
Other than that, I don’t really see anything that could cause the problem. I’d suggest removing that trigger once and putting a boolean variable in it’s place.
Something like this:
Repeat for each red_balloon:
Condition:
If scene boolean variable “redpopping” is false
Touch or left mouse down.
Cursor or touch on red_balloon
Action:
set “redpopping” to true
change animation of red_balloon
(…insert other code here)
Then create another separate event:
Condition
if redpopping is true
Action
wait 0.3 seconds (adjust wait time to your liking)
set redpopping to false
I don’t know if there are more elegant or efficient ways of dealing with it, if you find a better solution please do share.
Agreed. Trigger once inside for each doesn’t work as expected. Each instance is only going to be checked once per iteration. So, a trigger once isn’t needed inside the loop. You usually use the trigger once when needed before the for each so the loop only happens when needed and not on every frame.
For efficiency sake, I would move the mouse down and cursor/touch conditions outside of the for each. As is it’s going to go through each instance and check if the mouse is down for each instance whether the mouse is down or not.
It’s more efficient to have the for each as a sub event of the other events.
Mouse/touch
Cursor on object
Trigger once
–for each instance…
Conditions work like filters. If you check the mouse/touch first then the for each doesn’t execute, if the mouse is down then the mouse is on will filter and pick only the instances that are pointed to. In turn, the for each instance will only loop the same number of times.
With the trigger once it’s possible that if multiple balloons are popping that only the first is being processed. If the animation doesn’t get changed then the ballot doesn’t get popped.
Are they floating off the screen?