broadcast message received three times?

Hi! My program's main function is to shoot pellets (cloned) at targets (cloned), and a target that is hit should ask for the user to solve a math equation. I used an if (checking condition) block to see if the pellet is touching the target, then a message is broadcasted to prompt a procedure, then the pellet clone is deleted. The procedure in my target code fixes a random item from my list into a local variable and asks the user for the correct answer (according to my designed list). (just in case, i also put the procedure all into a custom block for organizational sake).

(bug) Whenever I hit one of the targets with a pellet, the user is able to answer one of the questions, the scoring system seems to work perfectly, but the sprite aks another randomly generated equation two more times, all answerable and scoreable. Which leads me to suspect that my broadcasted message from the pellet sprite is somehow sent or received three times.

Why is my procedure being prompted three times? thanks!! sorry im young and new to this

Hi, welcome to Snap!.

So, first of all, I'm curious:

My question is, do you think that a game that stops in the middle to give the user math questions will be fun? Or is this a homework assignment?

Anyway, if you want help with this, please share your project and post a link. In the Open dialog, the one you see when you're asking to load a project into Snap!, once you've selected the project, instead of pushing Open, push Share. Then go up to the URL display at the top of the browser window, which will look like "https://snap.berkeley..." Copy the URL and that's what to post in your reply here.

Maybe it's because the sprite wasn't despawned in time, so as it was disappearing, the touching block triggered again and broadcasted the message?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.