Weekly BuGS Update

This week I finally implemented the code to prevent the player from moving on top of mushrooms.  The implementation wasn’t too bad.  I look at up/down first and if moving in one direction, I ask if the tile system if the tile the player is entering is occupied.  If it is, then I reduce/increase Y to be a multiple of 8 so it is on the previous tile boundary.  That tends to be an inc/dec followed by an and operation to be a multiple of 8 which is pretty fast.  Because max displacement in a single frame is 8 pixels, that should always do it.  Similarly for left/right which I handle after up/down.  It does mean that if you move on a diagonal, say left and up and you are blocked in the up direction at your starting point, then you will not move up even if after the left displacement, the up direction is now clear.  I could retry the up/down movement after a successful left/right movement I suppose but I think this should be OK.  Other than that, I dug into two weird long standing bugs around centipede behaviour that I hadn’t investigate yet.  One was related to when a segment is added on the left or right after the centipede reaches the bottom of the screen.  If the point of entry is blocked by a mushroom, the change direction code would turn the segment around, facing away from the game screen which was bad.  I now ignore obstructing mushrooms when a segment is entering the game screen.  The second one was a bug where slow moving head segments did not correctly detect collisions with other centipede segments and change direction.  This lead to weird problems where two slow moving head segments could end up stacked.  You might think you only had one segment left but there were two stacked.  That is now fixed.

I don’t have any other known serious bugs right now and game play is basically complete.  The remaining items are high scores, two player and of course sound.  I did some searching for samples from the original arcade but I couldn’t find anything online yet.  Worst case, I think I can capture some audio samples using mame.  But that will have multiple sounds playing concurrently during normal game play so isolating the flea, spider, scorpion, etc sounds will be tricky and annoying.  Suggestions definitely welcome.  I also spent some time reading docs about sound on the GS.  Should I use the Sound Toolset?  Or do I need to go right down to hitting the sound GLU registers for performance reasons.  Again, wisdom about game sound programming on the GS definitely appreciated.

Source Code

Changes

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.