ironkayman/tftm-alien-invasion

Unify `Starship` and `Alien` basic logic

Closed this issue · 1 comments

Since both Starship and Alien have:

  • capacity to be damaged (health)
  • can fire bullets
  • movement
  • states
  • ...
    create an ABC-Class which is built upon States logic (see data/aliens/.toml) and Loadout (see config/.json::starship). Consider that Info field is included into states, since states are a behavior-oriented part of an enity, which also defines the current state's loadout, (this means that default/initial state has some preset loadout, usually hidden but can be described inside a config, and is overriden by every next state if the defenition is present).

For Starship entities, which are generally conrolled by the player, tthe json-config defines only current loadout; the states are a fixed internal propery, while the Alien entity can freely define states, but currently has loadout set by same presets.

The logic and method of definition should be abstacted from entity itself excetp the fact that it is an Alien or Starship entity - methods of getting the aproppriate config-objects are outside of the entity constructor class.

outline

A possible way we can integrate aliens' state-logic is by introducing another mechaniic to a starship - there may be 2 hardcoded states (contrary to alien's statesc defined by it's config), one usual, and one for low/no healh.