Krazy Carnival

The idea for this game was to create a collection of the most popular carnival games and funfair games that I had played over the years. The first game to be tried was the good old wack-a-mole game and the first round of games was developed. The first test had 3 games, wack-a-mole, balloon darts and hook-a-duck and the overall idea is to have additional games that are released and can be added to the carnival.

BALLOON DARTS

 
With the balloon darts finished and wack-a-mole unnder development, I thought I'd go through the development process for this particular game in a little more detail than the others as it was hard to get the mechanism working exactly how we wanted. Having the BOX2D physics engine helped but there was also a lot of hard work put into the game. The game itself is based around joints and in particular the b2Revolute joint. Each time a new body is created a joint is also then created using the balloon body and the board. Some of the other features of the game inclde:
  • Accelerometer aiming
  • Accelerometer calibration for use at any angle
  • Dart follows the sight around the screen when a finger is touching the screen
  • Players coins are stored using a sharedInstance, so they are still saved when the game exits
  • Arrays for storing the balloons on the board and the coordinates to ensure balloons do not overlap
The main issue with the game was spawning new balloons to the board without them overlapping each other. Of course things were not that simple as there are two different size balloons and if all small ones were spawned, then there would be big gaps on the dart board. So I had to come up with a mechanism that would allow me to keep track of the balloons and ensure that new balloons would not cover others. 
 
I decided to have a set of coordinates for 15 balloons that would allow a mixture of small and large balloons th be added to the screen without overlapping each other. These coordinates were then stored in arrays and the value for the location in the array was assigned either a small or large balloon depending on if it was odd or even.  The next challenge was to then be able to add the next balloon without it conflicting with the first one on the board. 
 
When a balloon is burst, the balloon is removed from the array of balloons on the board and its coordinates are removed form the coordinate array, that's the easy part. The next part is slightly more difficult and gets even more difficult when adding more than one balloon at the same time. I decided to use a for loop to loop through my main array of coordinates and check to see if each of them was present in the array of coordinates present on the board. If not, then this coordinate could be used and was put into a temporary array while the next coordinate was checked for the next balloon. The second coordinate though, had to then be checked against the array for current coordinates and the temporary array for coordinates of balloons not yet added to the board.

Wack-A-Mole