源代码:
package com.tarena.shoot;
import java.util.Random;
//Airplane----敌机既是飞行物,
public class Airplane extends FlyingObject implements Enemy{
private int speed = 2;//敌机走步的步数
public Airplane(){
image = ShootGame.airplane;
width = image.getWidth();
height = image.getHeight();
Random rand = new Random();
x = rand.nextInt(ShootGame.WIDTH - this.width);
y = -this.height; //y:负的敌机的高
}
//重写 getScore();
public int getScore(){
return 5;
}
public void step(){
y += speed;
}
public boolean outOfBounds(){
return this.y > ShootGame.HEIGHT; //敌机的y坐标大于窗口的高
}
}
出错:
---------- javac ----------
Airplane.java:4: 错误: 找不到符号
public class Airplane extends FlyingObject implements Enemy{
^
符号: 类 FlyingObject
Airplane.java:4: 错误: 找不到符号
public class Airplane extends FlyingObject implements Enemy{
^
符号: 类 Enemy
Airplane.java:7: 错误: 找不到符号
image = ShootGame.airplane;
^
符号: 变量 image
位置: 类 Airplane
Airplane.java:7: 错误: 找不到符号
image = ShootGame.airplane;
^
符号: 变量 ShootGame
位置: 类 Airplane
Airplane.java:8: 错误: 找不到符号
width = image.getWidth();
^
符号: 变量 width
位置: 类 Airplane
Airplane.java:8: 错误: 找不到符号
width = image.getWidth();
^
符号: 变量 image
位置: 类 Airplane
Airplane.java:9: 错误: 找不到符号
height = image.getHeight();
^
符号: 变量 height
位置: 类 Airplane
Airplane.java:9: 错误: 找不到符号
height = image.getHeight();
^
符号: 变量 image
位置: 类 Airplane
Airplane.java:11: 错误: 找不到符号
x = rand.nextInt(ShootGame.WIDTH - this.width);
^
符号: 变量 x
位置: 类 Airplane
Airplane.java:11: 错误: 找不到符号
x = rand.nextInt(ShootGame.WIDTH - this.width);
^
符号: 变量 ShootGame
位置: 类 Airplane
Airplane.java:11: 错误: 找不到符号
x = rand.nextInt(ShootGame.WIDTH - this.width);
^
符号: 变量 width
Airplane.java:12: 错误: 找不到符号
y = -this.height; //y:负的敌机的高
^
符号: 变量 y
位置: 类 Airplane
Airplane.java:12: 错误: 找不到符号
y = -this.height; //y:负的敌机的高
^
符号: 变量 height
Airplane.java:23: 错误: 找不到符号
y += speed;
^
符号: 变量 y
位置: 类 Airplane
Airplane.java:26: 错误: 找不到符号
return this.y > ShootGame.HEIGHT; //敌机的y坐标大于窗口的高
^
符号: 变量 y
Airplane.java:26: 错误: 找不到符号
return this.y > ShootGame.HEIGHT; //敌机的y坐标大于窗口的高
^
符号: 变量 ShootGame
位置: 类 Airplane
16 个错误