public class Team {
public int health;
public int x;
public int conflict;
}
public class Test extends Activity {
Team enemy[] = new Team[50];
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
for(int i =0; i<enemy.length; i++){
enemy[i].health = 0;
enemy[i].x = -100;
enemy[i].conflict = 0;
}
}
}
for 루프를 사용하면 for 루프없이 내 게임이 중단되고 실행됩니다. 내가 도대체 뭘 잘못하고있는 겁니까? 미리 도움을 주셔서 감사합니다!루프 용 객체 배열
Team enemy[] = new Team[50];
모든 항목이 null
입니다 : 당신이 배열을 만들
-1 매우 간단한 디버깅이이 문제를 해결했기 때문에 -1입니다. –