First 2D experience with Unity


Hello community,

Creating Gunplay was my first experience in making 2D games using the Unity game engine. Prior to this, I have only ever used unity in 3D projects or non gaming ways. Apart from using the engine, I have never created or worked with 2D game assets (outside of the ui) and the Physics2D.To my surprise the switch from 3D to 2D was as dramatic as I imagined, the 2D components I've used are similar to their counterparts in 3D (RigidBody2D, Collider2D, etc...). 

I appreciated the out of the box tools without ever needing to download 3rd party components or plugins. For example adding platforms is as simple as adding a components and configuring couple dropdowns straight in unity without the need to code. I think this is great for any artist that wants give their creations life with no-code or low-code solutions, while retaining high quality feel and polish.

In GunPlay however, I've decided to take a different approach and programmed from scratch to understand the mechanics and learn something new. Starting with the level containing single ground piece with a collider, I've started building the player controller, which was placed on a blank area that was the size of the arena level so that the controller values such as speed and jump could be configured properly. These values were also exposed and configurable in the editor for any team member to make changes during playtest to find the best "feel".

Next was the main camera which (I was a bit rusty) took me a little longer than I would like to admit to figure out, but turns out it's pretty straightforward;- locking the max position on all axes and keeping track of the local position relative to player so  your character can leave the centre of the screen at the corners of the level and most importantly the ground. The maximum camera values are also editable in the editor allowing for easy level expansions.

The enemies were probably the most challenging task that didn't unfortunately ended up unfinished. I've created a base class of enemy simply called a zombie, the idea was to inherit from this base class to have multiple distinctive enemies such as heavy slow zombies, jumping zombies etc... The only enemy that appears in the submitted game is the teddy bear, the most basic enemy, which purpose is to follow the player in masses and attack as they get in range, the main challenge here was the range of the attack as well as making sure the bear can only deal damage once per attack, otherwise the player would die instantly, which still happens if the player bumps into a horde of bears all attacking at once as all the colliders register a hit with the player. Next planned enemy was a clown, with jump zombie as the working title. Its purpose to be rarer than bear but more dangerous as they would jump around and perform attack at range. All resources were created, however the working prefab was never made.

Overall the enemies ended up simple, and due collider interactions they shove each other around which creates sort of organic looking piles of enemies in the style of world war Z movie, however they do that even during attacks, so the player doesn't realize they actually stop moving while attacking. This can be 'fixed' in post-jam update

Final aspect I want to talk about is the game intensity, a director script which controls the game keeps score, time, number of enemies, corpses and player health and performs multiple tasks such as score calculation, updating the gui, cleans up dead enemies, spawns new enemies but most importantly controls the game intensity. We have 5 levels of intensity the game director can choose from and player can distinguish it by the change of music tempo and tone. The transitions are subtle as the music composition is masterfully done and is controlled by Wwise, the only plugin used in this project, but the music per level is very different, going from a calm tempo to into a high speed track to get the action going as more enemies fill the screen with each level.

I really wanted to share some of my first experiences as I visited the world of 2D games for the first time, and hopefully gives you some idea of the process of releasing this gamejam project from the code perspective :)


Kubos.cz

Get GunPlay

Leave a comment

Log in with itch.io to leave a comment.