i am making a game with cactus pictures but when i do my code if its trying to switch between pictures it will stop and nothing works on that point al the names are correct but with the else if it does not work my code:
private Cactus getRandomCactus() {
Cactus cactus;
cactus = new Cactus();
cactus.setX(600);
if(random.nextBoolean()) {
cactus.setImage(imagecactus1);
}
else if (random.nextBoolean()) {
cactus.setImage(imagecactus2);
}
else {
cactus.setImage(imagecactus3);
}
return cactus;
}
what is the problem
Aucun commentaire:
Enregistrer un commentaire