Submissions from 2017-10-20 to 2017-10-21 (1 total)

The next logical progression of my turn-based system is to try to add something other than movement to it. So I decided to try to implement a very basic 'attack' ability.


Here's how it works for now:

  • If it's the players turn, pressing spacebar activates 'attack' mode.
  • Attack mode uses a different 'TileMask', and is visualized with red gizmos
  • Clicking on a valid (passable) tile, that also contains an enemy, results in a successful attack and finishes the turn. Anything less than that prints out some warnings, but doesn't consume the players turn (player stays in attack mode until a successful attack, or goes back to movement))
  • A successful attack just deletes the underlying gameobject for now

This actually required getting the bare-bones of a couple other systems working first:

  • What does it mean for a gameobject to be 'in' a tile? This info wasn't being kept anywhere. Now, the World class, which holds the TileMap, keeps a data structure of Entity positions which can be queried.
  • Upon completing a turn, the base TurnTaker class will update the World with his new position, so the World doesn't need to poll every frame or otherwise keep track. Derived TurnTakers also don't need remember to update their position every turn.
  • In order to gain the above benefits, the canisters needed to become proper TurnTaker entities, even though they won't do anything.
    • I derived a new TurnTaker, called Box, that, when given a turn, does nothing and immediately finishes. Can't get much simpler than this:


All the above was thrown together pretty hackishly just to make sure I had a handle on things. I will need to add proper interfaces for things like taking damage, dying, attacking, etc. But it's a proof of concept!