Taking the next step…

In my last post, I had mentioned that I would like for my next entry to be more technical and to share with you how I made Shape Popper. After some thought, I have changed my mind a bit. This entry will still be technical, but I have decided to move ahead and talk about my next game instead. My reasoning behind this change is because I would like to move forward rather than look back. My first game will always be special since it’s my first one that broke the ice for me, but part of progress is being able to let go and move on to the next one. My other reason is writing about it here and keeping logs may be a way to motivate me so I can work harder and finish it.

After my last game, I was brainstorming and jumping between different thoughts and ideas. Ultimately it got down to two different battles. The first battle was do I want to create a small simple game with an addictive factor (Like Ketchapp games for example), or do I actually want to spend the time and develop something a little bigger? After some serious thought, I have decided to tackle the latter, why? Because the kind of games I enjoy playing are games that tell a story and take you on a journey. I’m not sure if my next game will accomplish this, but I would like to try anyways. The second battle I was dealing with was which platform should I release it for, mobile or PC? Eventually I would love to make a PC game, but for the time being, I feel like the mobile market is a better place for me because the games there tend to have smaller scopes, and being a solo developer, this fits me perfectly.

With all of that said, let’s dive into what I’m working on. I’m not sure what to call this thing, but meet one of my main characters:


What is the game all about? I thought a cool platformer action adventure would be awesome to work on, growing up with Mario, Donkey Kong, and company has had that effect on me. So I browsed the App stores and looked for some examples to follow as ideas. I found many fun platformer games, but I noticed that most of them either had virtual buttons which took space or the player was already running/flying and you’re just controlling the jump/fly by tapping on the screen. I found neither options suitable for what I wanted to make. So I kept searching and eventually started running into games like Badland and Evil Cogs, that was it, the perfect platformer games for mobile, no virtual buttons, just a simple tap on the screen and you control your character, and unlike some of the runners/flyers out there, you’re in full control of your character’s movement. So I have decided that I will follow this pattern.

On the technical side, I’m using the Unity game engine to make this game, and Inkscape for the art mostly. I usually start making a prototype to see if it’s worth my while. For this game, the first step I did was make the character movement. Within Unity, we create an empty scene:


I’m working on an Android project at the moment, but will do both Android and iOS. Since this game will be a platformer, I had set the aspect ratio to 16:9, which is the default landscape view on most of the modern mobile devices. This will be something we will make more dynamic in the future since there are different aspect ratios out there depending on the device, but for now, 16:9 is a starting point.

Next up, we drag a sprite image into the screen, I also prefer to change the camera background color to dark for clarity:


We give our little green character some physics properties by attaching a rigidbody and a collider to it:


The purpose of the rigidboy and collider is to give our character the physics features of colliding with other objects and reacting to gravity when flying. Then we create a script that will control the character’s flight. We will be using C# as our programming language, which happens to be the most commonly used language in Unity (For those who like JavaScript, you can use that instead, there’s also Boo which is Python like, but not many use it). Our script starts off like this:

using UnityEngine;
using System.Collections;

public class ShapeMovement : MonoBehaviour {

    private Vector2 jumpForce; //Jump Force.

	// Update is called once per frame
	void FixedUpdate() {
        //If the let click (Which can also mean finger for mobile), is pressed and also held down.
        if (Input.GetMouseButton(0))
            //Getting the current mouse/finger position.
            Vector3 mousePosition = new Vector3(Input.mousePosition.x, Input.mousePosition.y, Input.mousePosition.z);
            mousePosition = Camera.main.ScreenToWorldPoint(mousePosition);

            //Determining the mouse and current object positions.
            float mousePos = (float)System.Math.Round(mousePosition.x, 0);
            float objPos = (float)System.Math.Round(transform.position.x, 0);
            //If the mouse/finger tap position is greater than the object (Right of the object on the screen),
            //we fly the object to the right.
            if (mousePos > objPos)
                jumpForce = new Vector2(2, 2f);
            //If the mouse/finger tap position is less than the object (Left of the object on the screen),
            //we fly the object to the left.
            else if (mousePos < objPos)
                jumpForce = new Vector2(-2, 2f);
            //Else, we fly in our spot.
                jumpForce = new Vector2(0, 2f);
            //We set the velocity to zero and add relative force value based on our tap choices.
            GetComponent<Rigidbody2D>().velocity = Vector2.zero;

Before we attach the script above to the character, we need to lower the character’s mass in the rigidbody (I’m using 0.01 instead of the default 1), and check the constraint on the z-axis so the character does not rotate.

Once we attach the C# script to the character, you should get the following behavior (I added some 2D Boxes with colliders for demonstration):


Just like that, we have the base for our player controller, granted a lot will change in the future, but the core is there 🙂

I think I will end the entry here, I’m not sure what the next one will be like, but we’ll probably carry on where we left off in this one.

Just a note, I have actually done further development on this prototype, in a nutshell, it looks something like this:

Screen Recording (5-25-2017 4-43-52 PM)

But I’m just writing the steps on what led me to the GIF above, which is the base and style for my game.

Until next time, back to work for me 🙂


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s