Tuesday, December 8, 2015

Minigame Base class

I have already written two minigames for Very Bunny Haha as I have documented in previous Blog posts. Well I knew when writing the first one I would be writing Many many  more. This meant I approached the coding task in a very certain way, always being mindful of where I placed particular parts of the actual minigame code and variables, and trying to keep them separated from what I would call common code.

Common code:
This is code that controls the stuff that all the minigames have in common (duh!). Such as the countdown timer, the Game Over control, the timer and of course the Instructions overlay.

So when I wrote the second Minigame I took the first ones code and changed the actual games code, but leaving he common code the same. Well actually there were a few modifications I had to make but that was expected. Once I had two minigames working I knew the common code was ready to be separated from the games code.

It took me a surprisingly small amount of time to separate the base class from the minigames code. In fact about 40 minutes saw me first do the 'WaterBall Minigame', and about 5 minutes for 'Zoomy the Porcupine' game.

Now writing the next Minigame will go faster smoother and I can easily add more common code and functionality to the system.

I highly recommend this approach,

G'night
Da Voodoochief

No comments:

Post a Comment