Learn You a Game Jam Day 2 devlog


Day 2 and I'm still in the middle of tutorial.

I'm already seeing where I will change and what I can do to improve it. I find when it comes to tutorials if I follow blindly I tend to not know what I'm doing. I'm trying to manually type out everything as well as try to figure out what the class is doing before moving on. It helps that in the tutorial it's sectioned off with ways I can test my progress.

Things I've learned:

  • How to create a state machine and changing states through script. The states are separated by script and loaded/unloaded by component.

public virtual T GetState<T>() where T : State
    {
        T target = GetComponent<T>();
        if (target == null)
            target = gameObject.AddComponent<T>();
        return target;
    }

This is good for sectioning off between phases, for example in the tactics: Unit Selection Phase, Player Turn Phase, Enemy Turn Phase, Battle End Phase, etc.

  • Instantiating GameObject prefabs

public void Load(LevelData data)
    {
        for (int i = 0; i < data.tiles.Count; ++i)
        {
            GameObject instance = Instantiate(tilePrefab) as GameObject;
            Tile t = instance.GetComponent<Tile>();
            t.Load(data.tiles[i]);
            tiles.Add(t.pos, t);
        }
    }

This allows me to create gameobjects at set positions which is really useful in building levels as well as creating units and environments.

So far pathfinding is extremely broken for me so I have to figure out what's wrong with it, but at the same time I don't want to spend too much time so I'll probably just forge ahead and take what I learn and incorporate into something manageable. Baby steps.

Get Monster Tactics

Leave a comment

Log in with itch.io to leave a comment.