|
This week I’ve been continuing on putting the last touches on the game. Bug fixing and cleaning the code. I would have preferred to put all my effort into the music but I am more needed in programming. The music and sound works as it is, even though I’m not a hundred percent satisfied with it. But I had to prioritize making the game playable.
Me and the producer took some time this week to try and break the game. Button mashing, finding bugs and such. Pretty soon we found an exploit. If the player pressed the fire projectile button (Z) at the same time as the transition button (space), the player never went underground but instead created a huge amount of holes. This forced the Gardener to spend all his time filling them with water.
How the exploit looked in game. Since the player never has to go under ground, and with the gardener always busy, it was easy to get the highest score (the score multiplier resets when the player goes under ground).
So what I did to solve this, was to check the player’s finite state machine. There was a problem with the throw and transition states. By pressing Z the transition state was ”overridden” and forced the player out of the state before the animation and transition was played through. To solve this, I just added m_state != STATE_TRANSITION to the if statement for the throw state. What that means is that the player can only enter the throw state if both the Z key is pressed and the active state isn’t STATE_TRANSITION. I chose this way to correct it because it required the absolute least amount of code.
I also fixed the Sonic Spike. This is an in game obstacle that blocks the players way and can only be destroyed by hitting it with a rock. As an item it’s based on the mole trap you can buy that emits a high pitched noise that moles supposedly doesn’t like.
The large transparent ring represents the hitbox and the small ring expands outwards in an animation.
Before the change, getting too close to the sonic spike resulted in a loss but we decided to changed it to act like a wall, blocking off the vegetables. So I had to write a stop move function that could be called upon collision. Lack of time and knowledge made me do the most simple one I could think of. Which is basically moving the players position back a few pixels if collision occurs. Just setting the velocity to zero would result in the player getting stuck at the point of collision. I would like to have a better solution but this will have to make due right now.
Thank you for reading!
About Jens Berg
2014 Programming
|