As mentioned in my last post, I had some problems on how to handle states on the tiles of the map.
As a solution I will have a class called TileState, which holds the actual state of the tile on which it is referenced. But it will not only the tile that holds the reference, but also all the objects that are placed on the tile will have a reference. When a change happens in one of the objects, they can report this change to the TileState instance. When an object is added to the tile, it will have to consult the TileState instance any modifiers it has to the state, this will also happen when the object is removed from the tile. It will be necessary to have a counter to the boolean style states, such as if a tile is passable.
Instead of having the objects updating the state individually as leave the tile, an alternative would be having the tile query all objects again. I will not be doing this alternative, as this would require more computational power, and I therefore want to see if I can avoid it.
Friday, May 15, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment