Running Cat
Updated 7 months ago
Creating a casual game
Running Cat is a casual game created for Android devices, the goal of this game is collecting all the points you can while avoid the obstacles, when you collect more points the obstacles will increase.
The game is designed for android devices, this include the Android TVs, if you need a game to support Android TV for example you need to support a game pad, since TV devices doesn't have touch screen.

Creating the background.

For this game it will need background, our player is always moving through Y position up so our background needs to be repeatable like this.
In the Hierarchy you can see the BG_1,BG_2,BG_3 game objects those are the objects that are switching position when our player is moving up.
This is the script used to move the backgrounds object they're the same sprite. The idea of this is by moving the last background object at the top of the scroll. Of course this can be some simpler, I just want to share what I created in this game.
private void LateUpdate() { position1 = Background1.position.y; position2 = Background2.position.y; position3 = Background3.position.y; float small = Lowest(position1, position2, position3); if (mainCamera.transform.position.y >= small + 12.0f) { if (small == position1) { MoveSpriteBg(Background1); } else if (small == position2) { MoveSpriteBg(Background2); } else if (small == position3) { MoveSpriteBg(Background3); } } } private void MoveSpriteBg(Transform tr) { tr.position = new Vector3(tr.position.x, tr.position.y + 24, tr.position.z); } private float Lowest(params float[] inputs) { float lowest = inputs[0]; foreach (var input in inputs) if (input < lowest) lowest = input; return lowest; }

Obstacles or Traps

I created the obstacles using a library to create actions like the way of cocos2d-x. I use this library. in my previous game I use cocos2d-x to create actions or sequence when I need for example rotate a game object or when I need the obstacle to move to the left, then to the right in 10 seconds, for example. Of course later I know about iTween library, it have similar results.
So to make the rotate sequence I need something like this.
public void start() { CC.Action.Run(transform, new CC.RepeatForever(new CC.RotateBy(1, new Vector3(0, 0, 90)))); }
That will rotate a game but this is By using the Cocos2d-x library action, this library is useful for users that make a game in cocos2d-x and then want to port to Unity game engine.


The player here is a cat and to use this Cat in the game first I create just 3 frames for the animation, idle and run idle is just 1 frame and running are 2 frames. The Player game object have a Rigidbody2D and Collider2D (2DBox) to interact with the obstacles and points.

Performance Issues

When I complete the game I try make it playable in Fire TV devices, the game doesn't work fine in the first test, every time when an obstacle was appearing the game have hip cups , because when I try to hide and show new obstacles I was creating and destroying objects.
I rewrite this game 2 times learning Unity in the lastest version the game performance have increase by using pooling objects, sprites atlas, and for decrease file size compiling using IL2CPP this game final build for android is just 14 mb (Only using ARMv7)
Making the game compatible in portrait mode and landscape mode was another challenge, this was done by organizing the UI.
Updating the game
After the Unity2D challenge I make some updates that improve the performance in the game by replacing my own camera follower by using Cinemachine2D by replacing the camera follower now have a better result when the game is played in different screen resolutions.
You can find the game on the amazon app store and play store.
  • Amazon App Store
  • Google Play Store
  • Web GL(Only PC)
Thanks for reading Oscar Leif.
oscar fernandez
Software Developer - Programmer