Most Significant Digit

Saturday, December 19, 2009

Fixed bugs in SEEK*TOR

I finally tracked down the bug in SEEK*TOR that sometimes makes the red enemy square (and some of the ally turrets) unclickable. While I was at it, I squashed a few more bugs I found along the way.


Play SEEK*TOR v 1.2

Changes in this version:
  1. Fixes bug where the upper-left turret is unclickable
  2. Fixes bug where sometimes the red enemy square is unclickable
  3. Fixes bug where on very high levels, the level never starts
  4. Turns off debug flag so turret layouts are randomized between 4 choices instead of just one
  5. Background music now loops
So what caused the unclickable-things bug, and how did I track it down?

With the help of debug output, I discovered that when a turret or enemy was unclickable, it was because something else on the screen "stole" the click event. In the unclickable upper-left turret bug, the click event was going to the flare display in the upper-left. In the unclickable enemy square bug, the click event was going to an object with a name like SpriteXXX. XXX was a number that was larger the later in the game the bug appeared.

The object name was my biggest clue. The number meant that it was a sprite that was created every level. The turrets are created anew every level, but they show up as TurretXXX. So I combed through the code until I found a sprite that was being created every level.

The sprite I found was the little explosion graphic that shows when you click on the enemy turret. In my competition-driven haste, I'd written code that created a new sprite every time the explosion went off, and didn't bother to make it unclickable, or remove it from the stage afterward.  To fix the bug, I modified the code so that it created the explosion sprite only once and reused it every level, and I made sure the sprite was unclickable. That fixed the bug.

Labels: ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]



<< Home