9Lives Mobile App - Development Blog #6 - Technical Analysis

Here I will highlight a few snippets from the code to show how some of the core mechanics work.

The player controls the cat by swiping in the direction that they want to cat to be launched in. This is done by getting the starting touch input position as a vector, then the touch position where the finger is released, and calculating a direction vector based on those.

There is lots of logic built around this code to make the game feel more fun and challenging. For example, if the finger has not been released after 0.5 seconds, the start position smoothly travels back to the fingers current position, making the direction vector magnitude lesser, therefore there would be less power. This prompts the player to make quick decisions in order to not lose lives.

The cat ball is set to different states via enums which give the ball different properties. For example, when the ball is in a “Ready” state, the rigidbody is set to Kinematic so it can’t be moved, “Active” means the ball has been fired and the rigidbody “isKinematic” is set to false, “InGoal” means the cat has entered the goal box, therefore the bounciness is lowered.

There is more code throughout the game which has been kept as simple as possible to make the game easy to update in the future.

3 views0 comments