Monday 25 August 2014

Ludum Dare #30 Dev Journal: Salvation - Working on the building functionality



So far it’s going slower than I anticipated. I am cringing at how bad I’m writing my code. I’m using public GameObject variables to just store a buncha prefabs. I then plan on instantiating these prefabs based on button clicks. At the moment I’m just removing (Destroying) a GameObject and instantiating a new one in the same place (Vector). I do this because I really don’t think I have the time to code solution that overwrites the GameObjects components. And I can’t overwrite a GameOjbect with another one, gives me an indexing error. My solution is pretty hacky but it’ll work for now.

This would probably be the view part of a MVC design. I feel like I’m working backwards as I have no assets yet. Just a lotta placeholder stuff.
Still having fun though. I best get back to it.

- Improvement ideas -

  • Build building placement system, rather than the pre-planned spots (EmptyRoom GameOject). Maybe instantiate – move with cursor (in Update()).
  • Don’t use loads of different building prefabs, use a Building class instead and inherit from it.
  • Find better way to load in buildings, or overwrite GameObject components. You can’t overwrite a GameObject with another directly.

No comments:

Post a Comment