Hi,
I'd like to update some of my game's code so that it could be more efficient and easy to deal with.
Here is the result I want :
In Healer Quest, each level is the same layout and same event sheet, but sees you fighting different enemies. I would like all the 4 player's characters to automatically attack enemies at random based on the current level (selecting a valid target).
There are enemies on the first line and enemies on the second line, and of course they should attack enemies on the front line first (refer to my signature for a visual clue, even though there is only first line enemies in the picture).
Here is how I did it :
For each playable character, I made a huge list of all levels (more than 100) and the code looks like this :
(...)
Level = 32 (you are fighting rats (1st line enemies) and bats (second line enemies))
Rat is visible
Pick random rat instance and deal damage to it
Else Bat is visible
Pick random Bat instance and deal damage to it
Level = 33 (you are fighting thieves (1st line enemies) and knifeThrowers (second line enemies))
thief is visible
Pick random thief instance and deal damage to it
Else knifeThrower is visible
Pick random knifeThrower instance and deal damage to it
(...)
What I would like to change :
Right now, if I want to change something in the way damage is dealt to monsters, I need to update more than 800 events! And I will need to update this code many times in the following months... So I'm looking for a solution to avoid this.
I hoped I would be able to do this with functions, but if I'm correct, it appears that functions doesn't allow to define a certain object to which the function should be applied.
Is there any simpler way to deal with that part of the code?
Thanks in advance for any ideas!