- Add a new
Attack action, such that if a player attempts to move into a cell occupied by a monster, they attempt to attack the monster, instead of just ignoring the keypress.
- Design and implement a health system. Games traditionally crib from Dungeons and Dragons, where every player and monster has some number of "hit points", successful attacks reduce hit points, and getting to below zero HP results in death. That's perfectly reasonable, but if you have opinions about health systems, feel free to design your own. ("Hit points" is very abstract and actually more closely resembles "exhaustion" rather than "injury". In realistic combat, successfully hitting a guy with a sword in anger can be a permanently disabling condition. If you want a health system that actually tracks cuts, bruises, sprains, dislocations, etc, go for it.)
- Design and implement a combat system. The basic question is "how much does an attack succeed?" for example, systems often have outcomes like "extra damage, regular damage, reduced damage, no damage, you hurt yourself instead". In D&D the system is that a monster has an inherent difficulty to hit from 1 to 20, the player generates a random number between 1 and 20, and if they match or beat the difficulty, the attack succeeds. Again, the level of realism is up to you.
- If the result of an attack is the death of the monster, there are two ways to do it, your choice. (1) The monster drops all its children, or (2) create a new entity type
MonsterCorpse, create an instance of a corpse entity, and the monster's children are reparented to the corpse. In either case, the monster's parent becomes null, removing it from the level.
We'll do monster attacks player next.
Attackaction, such that if a player attempts to move into a cell occupied by a monster, they attempt to attack the monster, instead of just ignoring the keypress.MonsterCorpse, create an instance of a corpse entity, and the monster's children are reparented to the corpse. In either case, the monster's parent becomes null, removing it from the level.We'll do monster attacks player next.