Xerra's Blog

Drunken coder ramblings

Warp mode butterflies are extinct —

Finally tracked down a nasty bug today which has been in the game since I first added the butterfly movement routines. Due to me using tiles for all the game play objects in this game, I’ve had to write a particularly long and cumbersome script to handle the movement pattern of the butterflies in-game. Currently it’s the only moving enemy in the game, even though fireflies are still present where they should be.

According to research on the original game, the fireflies used an almost identical movement pattern so my plan was to get the butterflies right and then copy the routine for fireflies, just changing the object references and tweaking them to work slightly different. As I’ve had this bug with the butterflies, the code isn’t working right, so there was no reason for me to move it over yet so the fireflies just sit there right now.

This is very noticeable, even playing the early levels, as you actually encounter the fireflies in level 3, one before the butterflies.

So, the bug was a problem with movement in two directions, where the butterflies decided to not move one square at a time and actually warp straight in that direction until they could not go any further. Effectively, they cheated and it was flippin’ obvious.

The code is rather large for butterflies movement,as there’s so much  to keep track of. The only collision system I can really use with tiles is to have the same tile image but have four different ID numbers so the routine can work out where it’s meant to go depending on which way it’s currently going. If you’re moving up then check left and go that way if there’s an empty tile. If you’re blocked going left and up then you need to switch the tile image to the new id number for moving down and let the script start checking for the next butterfly.

I expanded on my already powerful in-game cheat mode to allow for butterflies to not be able to kill Rockford and then ran the butterflies all over the screen to watch their AI movement and look for further errors. Apart from randomly coming to a stop for no-good reason the AI does currently seem to be working as intended. So, hopefully it’s just that one glitch to fix and I’ll have another major part of the game in and working.

 


Categorised as: Boulderdash | Development | Game Studio 2



Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.