I'm trying to make a turn-based RPG like Dragon Quest and Wizardry but I'm struggling when trying to code attacks in enemies.
How I'm doing:
* Every "enemy" object has a health variable and they are grouped in a family ("enemies").
* I made a global variable named "selected" to track what enemy the player wants to attack.
* When the player click the "attack button", the instance within the "Enemies" family is picked and....that is when I don't know what to do! I wish I could make something like "substract selectUID.health".
I want to access the health variable of the UID selected but I don't know how.
Need I to make an attack for every object separately or there is a way to code a "standard attack" that works with every enemy in the game?