[SOLVED] Problem with reassigning a variable to 0

Hi everyone,

I shoot a bullet in a straight line over a particular distance. The actual distance the bullet travels is set by the time I press the left Mouse key. For doing this, I store the TimeDelta() passed during the keypress in a variable “power” and multiply it with the distance the bullet can move. There is probably a better method to do that but it works.

My problem is that the variable “power” is sometimes not reset to 0 at the end of the process. It works three, four times or so and then the values are added several times before it gets back to 0 and so on.

I have tried several things with Trigger once and the sequence of the events but always with the same negative result. What am I doing wrong?

if you press the mouse button to fire again, before the bullet reaches its maximum limit, the variable “power” is set with the new path … and this will also affect the bullet already in progress

1 Like

Hi Salvatore,

You are absolutely right. That was the problem.

Thanks a lot