Citizen Defense
Physics Puzzler
Citizen Defense is a 2D physics puzzle game where the player places different building blocks to protect their citizens from a barrage of catapult fire. Complete each level by ensuring at least one of your citizens is left alive by the end of the onslaught. Achieve maximum victory by saving all of your citizens without using all of your blocks. Will you be a respected and loved ruler, or make sacrifices to get by?
Creating Citizen Defense
This game was created in such a way that if I wanted to port it to mobile, I could do so easily by using only mouse controls. The idea behind this game was a bit like angry birds, but instead of being the birds, you were the pigs trying to defend yourselves and building structures that would keep you alive.
​
I had two main struggles when creating this game. The first was the catapult that launched the rocks. I tried to automate it using some projectile motion to have the cannon attempt to make shots on the citizens no matter where I placed them with a random arc and some set aim variance so they weren't always deadly accurate. I couldn't get this formula to work correctly and I also decided it probably wouldn't feel good to the player if their defenses weren't good enough due to random chance.
What I ended up doing was I created something akin to a level editor when it came to the shots. I would play the game and take manual control of the catapult, which gave me control over velocity and angle. I would make a shot that I liked and save it out to be used in the actual level. This combined with the player already having the ability to drag and place the the pieces into the level meant I was dangerously close to creating a level editor. As this was for a school assignment, I didn't quite have the time to do so, but if I were to revisit or re-create this game, it's something I'd certainly spend more time looking into.
The second struggle I had was with the UI. Creating a drag and drop system that grabbed things from the UI and moved them into real space required me to create the functionality almost from scratch. This wasn't that terrible but it was something I certainly wasn't expecting when I first started to set it up.
Something I learned after I had turned this project in came when I eventually did port it to mobile. I quickly learned that having to click on the shape itself was a huge pain on mobile because the player's finger would usually cover it up. One solution to this could be a zoom feature that allowed the player to pinch zoom and place their shapes as well as increasing the collision detection on these shapes to be more universally circular.




