我甚至不确定这个代码是否会做任何事情,即使它有效,但我不知道如何摆脱"从内部类引用的局部变量必须是最终的或有效的最终"错误消息,显示以"fireballRight [i]"开头的三行.
Sprite[] fireballRight = new Sprite[50];
public void fireRight() {
for(int i = 0; i < 50; i++) {
new AnimationTimer() {
public void handle() {
fireballRight[i].setImage("puercosloco/fireballright.png");
rightx++;
fireballRight[i].setPosition(rightx, righty);
fireballRight[i].render(gc, 80, 55);
}
}.start();
}
}
Run Code Online (Sandbox Code Playgroud)
任何指导将不胜感激,谷歌似乎没有帮助我这一个.