So I'm trying to subtract one integer value from another integer value, and I can't seem to get it to work?
Example of my problem,
int enemyHP = 10;
int playerDamage = 10;
//The player decides to attack the enemy and deals (playerDamage) damage to the enemy
enemyHP - playerDamage //Doesn't work, and I can't find anything else that works.
I know I can do enemyHP-= 10; but that isn't what I need, because playerDamage can be changed in the game, so it isn't always going to be a fixed number.
In your example, you can update the enemy's HP by subtracting the player's damage from it using the following code:
Or
Or you can define a new variable and put the result on that: