Explaining and telling you exactly how to do it are different. I try not to tell people exactly how to solve things, because they usually end up copying it and not learning from it. The point I was making though is that if the collision event between the monster and the player is set to repeat, then that if statement will trigger every frame that the actors are colliding, which is the only way (from the code you gave) that would cause that problem.
If you've already set it to disable, then perhaps there is a problem in game that you haven't posted the code for (like having more than one collision event), or your animation actually collides with the enemy twice in a single attack.
To do what I was suggesting though is pretty straightforward. If you wanted the if statement to only trigger once, even if the code repeats over and over, all you need to do is within the if statement (where it says do something) put some code that changes the value of var (for instance resetting it to 0).
- Code: Select all
if(var==1)
{
// do something
// setting var equal to 0 here would make the if statement no longer trigger
}
If what you posted really is the only way the die variable is changed, then doing the same with the if(collide.attack==1) statement will make it so you can only change the die variable once per attack.