Shiba Spin‘, a game where you spin a dog on a chair, (not too fast!) for our own little jam in 2017.

I carried out programming and audio, alongside 2D animations, whilst art was done by Kevin Wick & Fern Khaoroptham, Miles Callingham worked on design, and Sophie Shepherd did 3D animation.

This project was my second time creating a game for Android, and one of the first times I worked with json – which I used to store a database of items that could be equipped to your dog!

The json database followed this structure:

[
  {
    "id": 0,
    "name": "Black Sunglasses",
    "cost": 15,
    "consumable": false,
    "slug": "blk_sunglasses",
    "multiplier": 1
  }
]

I then had a script which read from the json file and converted the data into a list of items.

We decided to put points and coins into the game, the below code shows how I loaded the score info, and if none was found, created the file and awarded the player 20 coins.

Extract from Score.cs

        jsonPath = Application.persistentDataPath + "/score.json";
        if (File.Exists(jsonPath))
        {
            scoreData = JsonMapper.ToObject(File.ReadAllText(jsonPath));
            Load();
        }
        else
        {
            File.Create(jsonPath);
            coins = 20;
        }

        if (scoretxt != null)
        {
                scoretxt.text = "Points: " + score;
        }

Saving was also fairly straight forward, I used StringBuilder and JsonWriter from LitJson to save data. (I used LitJson throughout the project, however I am aware everything could also be done in Unity without it.)

public void Save()
{
    StringBuilder sb = new StringBuilder();
    JsonWriter writer = new JsonWriter(sb);
    writer.WriteArrayStart();   // Start of file

    writer.WriteObjectStart();
    writer.WritePropertyName("score");
    writer.Write(score);

    writer.WritePropertyName("coins");
    writer.Write(coins);

    writer.WriteObjectEnd();
    writer.WriteArrayEnd();

    File.WriteAllText(jsonPath, sb.ToString());
}

I also created the music for the game, aiming for a cute, relaxed vibe.