• 大小: 268KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-26
  • 语言: Java
  • 标签: java  

资源简介

此代码适合用于理解java基础,涉及到很多java基础的东西,封装,继承,多态表现的淋淋尽致

资源截图

代码片段和文件信息

package com.loveoyh.shoot;
import java.util.Random;

/** 
 * 敌机:是飞行物,也是敌人 
 */
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;
}
/** 
 * 重写getScore()得分 
 */
public int getScore(){
return 5;//一个敌机得5分
}

/** 
 * 重写step()飞行物走一步 
 */
public void step(){
y += speed;//y+向下
}

/** 
 * 重写outOfBounds()检查是否越界
 */
public boolean outOfBounds(){
return this.y >= ShootGame.HEIGHT;
}
}





























 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        301  2018-01-29 12:56  MyShootGame\.classpath

     文件        386  2018-10-26 07:40  MyShootGame\.project

     文件        598  2018-01-29 12:56  MyShootGame\.settings\org.eclipse.jdt.core.prefs

     文件       1069  2018-10-26 17:10  MyShootGame\bin\com\loveoyh\shoot\Airplane.class

     文件       3575  2014-12-19 10:20  MyShootGame\bin\com\loveoyh\shoot\airplane.png

     文件        216  2018-10-26 07:42  MyShootGame\bin\com\loveoyh\shoot\Award.class

     文件      26709  2014-12-19 10:20  MyShootGame\bin\com\loveoyh\shoot\background.png

     文件       1206  2018-10-26 17:09  MyShootGame\bin\com\loveoyh\shoot\Bee.class

     文件       6405  2014-12-19 10:20  MyShootGame\bin\com\loveoyh\shoot\bee.png

     文件       4015  2018-09-05 14:54  MyShootGame\bin\com\loveoyh\shoot\bigbee.png

     文件        867  2018-10-26 17:10  MyShootGame\bin\com\loveoyh\shoot\Bullet.class

     文件        408  2014-12-19 10:20  MyShootGame\bin\com\loveoyh\shoot\bullet.png

     文件        134  2018-10-26 07:43  MyShootGame\bin\com\loveoyh\shoot\Enemy.class

     文件        897  2018-10-26 17:25  MyShootGame\bin\com\loveoyh\shoot\Flyingobject.class

     文件      20220  2014-12-19 10:20  MyShootGame\bin\com\loveoyh\shoot\gameover.png

     文件       2370  2018-10-26 17:02  MyShootGame\bin\com\loveoyh\shoot\Hero.class

     文件      12280  2014-12-19 10:20  MyShootGame\bin\com\loveoyh\shoot\hero0.png

     文件      16243  2014-12-19 10:20  MyShootGame\bin\com\loveoyh\shoot\hero1.png

     文件      14902  2014-12-19 10:20  MyShootGame\bin\com\loveoyh\shoot\pause.png

     文件       1883  2018-10-26 18:02  MyShootGame\bin\com\loveoyh\shoot\ShootGame$1.class

     文件        949  2018-10-26 18:02  MyShootGame\bin\com\loveoyh\shoot\ShootGame$2.class

     文件       8590  2018-10-26 18:02  MyShootGame\bin\com\loveoyh\shoot\ShootGame.class

     文件      30696  2018-09-04 19:48  MyShootGame\bin\com\loveoyh\shoot\start.png

     文件        832  2018-10-26 17:10  MyShootGame\src\com\loveoyh\shoot\Airplane.java

     文件       3575  2014-12-19 10:20  MyShootGame\src\com\loveoyh\shoot\airplane.png

     文件        310  2018-10-26 07:42  MyShootGame\src\com\loveoyh\shoot\Award.java

     文件      26709  2014-12-19 10:20  MyShootGame\src\com\loveoyh\shoot\background.png

     文件       1032  2018-10-26 17:09  MyShootGame\src\com\loveoyh\shoot\Bee.java

     文件       6405  2014-12-19 10:20  MyShootGame\src\com\loveoyh\shoot\bee.png

     文件       4015  2018-09-05 14:54  MyShootGame\src\com\loveoyh\shoot\bigbee.png

............此处省略24个文件信息

评论

共有 条评论