You have this cute character made of goo that tries to get out of a pit by jumping from side to side, while avoiding or killing enemies that can get in your way.
The technical aspects of 'Gooing Up! is explained in this article. One will read about basic Unity3D stuff as well as technical decisions made during the development of the game.
Posted by Icyphoenix1 on Feb 20th, 2014
Hi everyone, and welcome to the thread about some technical stuff related to ‘Gooing Up!’.
Heiny already told you something about the origin of the game and I (Johnny Schaap) will tell you a little more about it. Not only will I tell you something more about the origin of the game, I will also tell you about how I created the environment, character movement, character animation, the camera movement and the GUI.
As Heiny explained, ‘Flappy Bird’ actually leaded to the start of ‘Gooing Up!’. I heard friends and family talk about the game all the time. I didn’t have time to play it myself but after hearing more and more about it, I spontaneously decided to try and create a mobile game. Although it appealed to me, I had never actually done this before, but how hard can it be? Especially with Unity3D by my side.
So on my way to the university I thought of a simple game that could be played on a mobile device and created it. After working on it during lectures, the game was finished by the time I got home. It consisted of mostly rectangles. Each of them either represented the character, the floor, a wall or a water droplet. The water droplets could kill you. Of course this wasn’t appealing at all, but I couldn’t care less as it was just a test to see how hard it is to create a game on a mobile device.
I was quite proud that I could create a game on the mobile in such a short amount of time and showed it to my girlfriend. She played it one time, two times, even 15 times. That’s when I decided to continue developing the game further. I contacted Heiny and after a long discussion, the game design was now done. We could start creating the game!
Now onto the more technical stuff! I first started to create quads representing the walls and the floor. I added a ‘RigidBody2D’ and a ‘BoxCollider2D’ to both of them to be able to detect collisions. I also turned on ‘Is Kinematic’ to enforce they don’t move by any force dealt to them. To minimize the memory load of the mobile I created two walls on each side and created a script that moved itself above the other as soon as the wall is not visible in the screen anymore. This wrapping effect is based on the distance to the player. When Heiny was done with the textures of the wall and the floor I added those to the objects.
For the background I practically did the same but didn’t add a ‘RigidBody2D’ or a ‘BoxCollider2D’.
The character consists of a parent GameObject with a few children. It also consists of a ‘RigidBody2D’, a ‘BoxCollider2D’ and a script that controls the character movement and states. We also add an ‘Animation’ object to it as a child. This object is explained in the next section. We also add an ‘EnemySpawner’ object to it as a child. What this object does will be explained another time.
The character has a few states. These states include ‘Standing’, ‘Jumping’, ‘Sliding’, ‘Dying’ and ‘Attacking’. The last one is currently not implemented yet. When the game starts, the character is in a ‘Standing’ state. As soon as we touch the screen it switch to the ‘Jumping’ state. Based on some parameters we change the horizontal and vertical speed of the character. We also do some vertical deceleration and let gravity handle some part of the jump as well.
As soon as the character collides with the wall it changes to a ‘Sliding’ state. We let gravity take over again (with different parameters). When the character hits an enemy, it switches to a dying state. Based on some parameters it will move up and then down again. After that the game is over.
To summarize, the character can change from ‘Standing’ to ‘Jumping’, from ‘Jumping’ to ‘Sliding’, ‘Attacking’ or ‘Dying’ and from ‘Sliding’ to ‘Jumping’ or ‘Dying’.
We all know that unity has its own 2D animation handler. Nevertheless, I wrote my own anyways. First I imported a sprite sheet and used the Unity tool to split it. Per character I add an empty GameObject and include the ‘AnimationStateHandler’ script. This GameObject consist of multiple empty GameObjects, each representing a state and has an ‘AnimationFrameHandler’ Script. These scripts
are relatively easy.
The ‘AnimationStateHandler’ script contains an array of GameObjects containing all the states. When switching to another state. It simply turns off the current state and turns on the next.
The ‘AnimationFrameHandler’ GameObject actually holds the sprites. Each of them are added as a child and all of them represent one frame. We can specify how many seconds a frame needs to be displayed until we switch to the next one. We can also specify if we want to repeat the animation. The mechanism is quite simple. We just set a timer and as soon as it ends, we move to the next frame.
The camera is actually pretty simple. As soon as the y-position of the character is greater that the y-position of the camera, we change the y-position of the camera to that value. That way the camera will follow the character when he is rising, but stands still when he is sliding down.
For now the GUI is very simple as well (for now). It only draws one line of text that includes the score. One point is added each time the character jumps.
I told you guys something about how ‘Gooing Up!’ started and talked a bit about some Unity3D stuff. It is pretty basic stuff but if you would like to know more about something you can always send a mail to JohnnySchaap1@gmail.com.