Unreliable Score Counter

rushgames

  • Posts: 6
Hello,

I have placed the attached code on the main actor of my game, who, whenever he hits a coin (a type of actor), the score should increment by 10. I have the code set to kill the last collided actor (the last coin that is hit). The code works, however, it sometimes adds 20 to the score instead of 10. Does anyone have an idea of why that is? Or can anyone help me resolve this issue?

Note: I have the actor type "coin" set to be a sensor.

Epic428

  • Posts: 1118
It's likely registering the collision twice. If it is it might be better to have a Boolean that if not set to true will allow the code to run. So it could be like this:

When this collides
If collected is not true
Then set collected true and kill self and add to score
James Moore - Official Support & Documentation.
We cannot and will not respond to PM's asking questions. Please make a new thread in the forums if you have any questions, Thank you.
For better support and faster response times, please post your logs regarding any Stencyl related issues. Debug > Logs > Generate Logs