I am working on a small tiny game where there is an attacker and defender.
Player Attacker = new Player();
Player Deffender = new Player();
}
}
class Player{
int armees = 0;
int tarningar = 0;
Dice Dices[];
Player(){
armees = 10;
Dices= new Dice[tarningar];
for(int i=0;i<Dices.length;i++){
Dices[i]=new Dice();
}
}
}
I commented inside the above code where I want to have an if statement to determine how many cubes it should have.
If this is impossible to do, maybe another way to do it?
I also tried
Attacker.tarningar = 3;
Deffender.tarningar = 2;
right in the place where the object is mainly defined, but it does not work, because it already executed Player () inside the class.
(im still new for java) thanks
Karem source
share