public static int wildPokemon(int opponentstats[] , int rattataStats[] , int geodudeStats[] , int pidgeyStats[])
{
rattataStats = new int[]{27,42,35};
geodudeStats = new int[]{35,45,80};
pidgeyStats = new int[]{39,33,33};
System.out.println(".");
Pause(1000);
System.out.println(".");
Pause(1000);
System.out.println(".");
Pause(1000);
Random wildPokemon = new Random();
int opponent = (wildPokemon.nextInt(3));
while(true)
{
if(opponent == 0)
{
System.out.println("You have come across a wild Rattata!!!");
rattataStats[0] = opponentstats[0];
rattataStats[1] = opponentstats[1];
rattataStats[2] = opponentstats[2];
return opponentstats;
}
else if(opponent == 1)
{
System.out.println("You have come across a wild Geodude!!!");
geodudeStats[0] = opponentstats[0];
geodudeStats[1] = opponentstats[1];
geodudeStats[2] = opponentstats[2];
return opponentstats;
}
else if(opponent ==-2)
{
System.out.println("You have come across a wild Pidgey!!!");
pidgeyStats[0] = opponentstats[0];
pidgeyStats[1] = opponentstats[1];
pidgeyStats[2] = opponentstats[2];
return opponentstats;
}
}
}
Ich bin so verloren und frustriert. Warum kann ich keine gegnerischen Stats und deren Werte zurückgeben? Danke für die Hilfe.Pokemon Spiel. Problem beim Zurückgeben eines Arrays JAVA
Ich bin froh, dass wir das schnell lösen konnten :-) – GhostCat