I'm working on my game X-Terminator, and I created a bug count for every bug you kill. I used the mouse button down event, bugs = bugs + 1;. The insects have two multi-file animations; walking left, and a dying twitch. When the ants are squashed, the bug count goes up a digit, and the ants dying twitch animation lasts for the remainder of the level. Then all the remaining ants are destroyed. However, I noticed that if you click on the ants, when they are on their dying twitch animation, the bug count is increased. To stop this I changed the, bugs = bugs + 1;, to
if(animindex ==0)
{
bugs = bugs + 1;
}
But when I clicked the ants, the bug count didnt increase at all, even when the ants had their dying twitch animation. So I changed it to
if(animindex ==1)
{
bugs = bugs + 1;
}
But this time, when I clicked, the bug count not only increased when the ants were walking, but it increased when they were twitching too. I also tried putting in this script,
if(animindex !=1)
{
bugs = bugs + 1;
}
But it had the same results as the first alteration I made. I also tried the opposite of this;
if(animindex!=0)
{
bugs = bugs + 1;
}
But it had just the same effect as the second alteration I made to the code. If anyone knows how to make the bugcount increase by 1, only when the ants animation is walking left, I'd be glad to know.