I'm stuck with the following:
attack: function() {
var p = roundSystem.instancePlayer();
var e = roundSystem.instanceCurrentEnemy();
e.eH -= p.pAD;
console.log(e.eH);
Is there a way to call the function with the inside functions only called once ?
I'm trying to do a Attack button where the enemy gets damaged. with the call I'm also creating copies of each the enemy and player, so I can later reuse the root object values for reseting the game. Problem is, this way calling the attack will result in no life reduction for the enemy, because the copies get called too and thus reseting their values.
Edit: Better explanation
e.eH stands for the enemy life
p.pAD stands for the player damage
Now once the attack button is clicked, the enemy gets damaged by the amount of the player Attack damage. The purpose of the copies from the objects are to make a reset function later on if one of the two dies. I can use the values from the copied objects than hardcoding, for instance, every case of health from the enemies.
Thanks in advance!