Looking for those darn bugs

Here is a clip of a small problem I had last week. It seems that when I killed my opponent my health immediately went to zero and I died as well. Here you can see I manually change the health of the opponent, he/she dies and poof so do I. Funny looking but not so funny when I could not find the bug.

Bug hunting is now over. I spent most of the day at work looking for this illusive critter and only after I went home, moved scripts around and segregated most of the code I finally found the problem. As it turned out, if I had taken the time to investigate at work like I had time at home I would not have had to do all the changes I did (but the code is nicer for it). All that had to be done was add the following to the condition of an if statement “&& !enemyController.dead”.

Below is the problem I experienced.

Leave a Reply

Your email address will not be published. Required fields are marked *