mardi 23 décembre 2014

How to use a random generated number in a parameter

So i am trying to change the enemies health based on a randomly number. When I try to pass a number using the random class I get an error:



The method changeEnemyHealth(int, int) in the type enemyStats is not applicable for the arguments (int)


And the code:



int enemyDamage = Random_damage.nextInt(31) + 270;
enemyStats.changeEnemyHealth(enemyDamage);
playerStats.changePlayerMana(-4);

public class enemyStats{

public static void changeEnemyHealth(int EHealth){
EnemyHealth += EHealth;
}
}




Aucun commentaire:

Enregistrer un commentaire