I was really excited this week to make a game with Processing (although I cannot say I was as excited to use object oriented programming). After a lot of work, I was able to create a simple (but super cute) one-player game that, for obvious reasons, I dubbed “Blobby.”
The game works like this:
- You, the player, are the cute, smiley, pink blob (let’s call her Blobby). You control Blobby by moving your mouse.
- All around you, moving randomly, are mean green blobs of various sizes. The goal of the game is to eat the mean blobs that are smaller than you (by running your Blobby into them) and avoid the mean blobs that are bigger than you.
- If you eat a smaller mean blob, you get bigger; if a bigger mean blob hits you, then you lose and the game is over.
- When you (Blobby) get as big as the height of the screen, you win the game. 🙂
Here is a video of me playing a few rounds of the game, and below is a screenshot of what the game looks like:
Creating the Game
First, I simply created the cute blobs in illustrator. I made one cute pink one, and three mean green ones (of different shades of green). Although the pictures below are different sizes (making the blobs seem like they are different sizes), I actually ensured that all of the illustrator blobs were exactly the same size.
The hard part, obviously, was the code, and using classes (which I still do not feel that confident about). You can view it here. I used classes to create 20 different blobs (1 is Blobby/the player, the other 19 are mean). Each blob has a random starting location and direction, and the direction only changes when the blob hits a wall. Whenever a blob hits another blob (ANY blob, even if it is just two random mean blobs), I find out which one is bigger, I remove/delete the smaller one, and then make the bigger blob even bigger.
The hardest part of writing the code for the game was, clearly, learning and trying to understand how classes work. While I understand the basics, and was able to (with lots of googling and help from others) make this game, I can’t wait to learn more about classes and become more comfortable with them.