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:
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.
Play SEEK*TOR v 1.2
Changes in this version:
- Fixes bug where the upper-left turret is unclickable
- Fixes bug where sometimes the red enemy square is unclickable
- Fixes bug where on very high levels, the level never starts
- Turns off debug flag so turret layouts are randomized between 4 choices instead of just one
- Background music now loops
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.