Tuesday, April 5, 2011

Overcoming Bug #3

Breaking up the problems with bug 3 of our project (the one which allowed the player to purchase more supplies than cash on hand) was a priority.  It didn’t take long to discover where the problem was and with a little effort I wrote a small method that accumulates the cost of supplies that the player WANTS to order and passes that value back to the method dealing with the purchasing of supplies.  I then used an IF statement that allowed the game play to resume when the player HAS enough money to purchase the supplies that they wanted to order.  The ELSE portion was where I hit a snag…I couldn’t figure out a way to keep the player on the “order supplies” screen until the comparison proved TRUE.  The existing “draw” method in the gui called everything that needed to be drawn, and the “draw_store” would not work independently; however, Francis figured out a way to overcome this and it does seem to solve the problem.  I spent a good hour this morning trying it and everything appears to work as it should.  He wrote an extra case in the gui class that allows for this circumstance and we are all happy!  I still would like to make a notification pop up that would tell the player that they tried to order more supplies than they had money to buy—we’ll see what we come up with at our meeting later on today.

No comments:

Post a Comment