void battle(){
srand(time(0));
if(turn == "Skeletons"){
accuracy = rand()%100;
if(accuracy > 60){
humanHealth -= skeletonDamage;
if(humanHealth <= 0){
numOfHumans--;
humansDead++;
humanHealth = humanHealthBackup;
}
}
turn = "Humans"; // I did turn == "Humans"
}
else if(turn == "Humans"){
accuracy = rand()%100;
if(accuracy > 60){
std::cout << "Breakpoint1";
skeletonHealth -= humanDamage; // I did on accident skeleton -= humanHealth xd
if(skeletonHealth <= 0){
numOfSkeletons--;
skeletonsDead++;
skeletonHealth = skeletonHealthBackup;
}
}
turn = "Skeletons"; // I did turn == "Skeletons";
}
}
From time to time this code tends to work, but more then often breaks. I could not really find anything wrong. I am just taking tutorials with MakingGamesWithBen on YouTube this is the first challenge he gave.
Aside from that, if someone could help me I'd appreciate it a lot.
Aucun commentaire:
Enregistrer un commentaire