Categories
Nature of Code

Balloon Burster

Balloon Burster is a game where the player attempts to pop as many balloons as possible. With five upgrades to choose from, the player can rack up points faster and faster until they unlock the secret win mode 😉.

Backup Link (if Neocities doesn’t work)

I began this middle semester assignment by playing around with fireworks. I created this sketch (Firework Frenzy), but was not fully satisfied with it being enough for this midterm. I did, however, learn a lot about particle systems in the process.

Anyways, I moved on to combining two of my previous projects, Cannon Commander and Balloons Bonanza. As a kid, I invested dozens of hours into the Bloons Tower Defense franchise. Thus, I sought to create some kind of BTD inspired game where the player can shoot and pop the balloons.

Send help as I have discovered Bloons TD 6 | GamingOnLinux
BTD 6 <3

I began by simply combining the two code libraries into one project and solving any bugs that arose. As you can see from the gif below, there wasn’t much gameplay to this. The balloons still spawned under your mouse pointer, there was no collision, no score, etc…

I slowly started to convert the project from two separate sketches and combined them into one cohesive game. Here was my To-Do list:

  1. Automate balloon spawning
  2. Add cannon movement control
  3. Remove the charge shots and add a cooldown timer
  4. Add collisions so balloons can be popped
  5. Add a point system
  6. Add upgrades
  7. Some kind of win state

Automating balloon spawning came from a technique I learned while creating Firework Frenzy. In the Nature of Code example for fireworks, the spawning is handled by a line of code similar to this:

This solution allows for spawning at random intervals, which I used for my fireworks and for my balloons. Here’s what we got so far:

A little better! I had a little difficulty with creating a reliable countdown timer. I settled on using millis() and storing the value whenever another shot is fired to count down from. It certainly is not the most elegant solution, but it gets the job done. I also added the cannon movement. Which, again, is a little janky but gets the job done. I had trouble figuring out how to control the limits of the movement elegantly.

Right now, it just sets cannon’s velocity to 0 when it reaches the max or min movement value. What would be a smoother way to achieve this?

For collisions, I stuck with using dist to treat the balloons as though they are perfect circles. This solution works well enough for now and it is hard to notice the pixel difference of missing the hit box.

Much more of a game!

Lastly, I added a bunch of upgrades for the user to speed up their popping of the balloons. As I have never really done much game development, I had some trouble ironing out the difficulty curve of the experience. The game, as it is now, starts off extremely slow and boring, but quickly ramps up. I think it is fairly enjoyable, but the values could use some tweaking.

Mid-Game gameplay

Following suite of popular games nowadays, I had to add some form of cosmetics. There are five levels of hats to upgrade to, ending in the secret golden hat.

I wanted to use a lot of CSS styling to really pretty up the game page, but simply ran out of time. The page, as it is now, is very bare bones and I might try to do some upgrades if I have time before class tomorrow. But, we are now at a playable game!

Future plans:

  1. GUI Refresh – right now it’s so plain and boring: add a custom font, better colors, icons, etc…
    1. Includes a mobile screen size as well
    2. Favicon
  2. More Upgrades – particle size, movement speed, movement axis, balloons size
  3. Visual Cannon Upgrades – as you upgrade your cannon, it changes in shape, size, and design. (more than just hats)
  4. Balloon Types – the different colors of balloons signify different attributes about that balloon (speed, size) maybe some split into two balloons when popped (similar to BTD)
  5. Code Organization – right now, the code for the project is very difficult to read and inefficient, would like to clean it all up
  6. Cannon Movement – figure out a more elegant way to control the cannon
  7. Popping Animation – using my code from the firework project, use a particle system to create a little popping animation for the balloons
  8. Lives? – there are no stakes in the game, need something to encourage the player to shoot the balloons more than just for fun

Works Cited

Fireworks Random Spawning Code:
https://editor.p5js.org/codingtrain/sketches/O2M0SO-WO

Millis Timer Code:
https://editor.p5js.org/jarivkin/sketches/rnhh7odPM

GAME WIN SPOILER:

Leave a Reply

Your email address will not be published. Required fields are marked *