资源简介
达内私有课程java面向对象课程,飞机大战项目,达内飞机大战素材包,包括所有代码,达内私有课程
代码片段和文件信息
package cn.tedu.shoot;
import java.awt.image.BufferedImage;
/** 小敌机:是飞行物,也是分 */
public class Airplane extends Flyingobject implements Enemy {
/*
* A:静态变量,静态块赋值-----------最好的
* --第一次new对象(方法区分配images一份,静态块赋一次值)
* --以后new对象----什么也不做了
* B:实例变量,构造中赋值
* --第一次new对象(堆中分配images,构造中赋一次值)
* --第二次new对象(堆中分配images,构造中赋一次值)
* --第三次new对象(堆中分配images,构造中赋一次值)
* C:静态变量,构造中赋值
* --第一次new对象(方法区分配images一份,构造中赋一次值)
* --第二次new对象(构造中赋一次值)
* --第三次new对象(构造中赋一次值)
*/
private static BufferedImage[] images; //图片
static{
images = new BufferedImage[5];
for(int i=0;i images[i] = loadImage(“airplane“+i+“.png“);
}
}
private int speed; //移动速度
/** 构造方法 */
public Airplane(){
super(4936);
speed = 2;
}
/** 重写step()移动 */
public void step(){
y+=speed; //y+(向下)
}
int index = 1; //死了时的起始下标
/** 重写getImage()获取图片 */
public BufferedImage getImage(){ //每10毫秒走一次
if(isLife()){ //若为活着的,则返回images[0]
return images[0];
}else if(isDead()){ //若为死了的
BufferedImage img = images[index++]; //images[1]到images[4]
if(index==images.length){ //若到最后一张图片了
state = REMOVE; //将对象状态修改为删除状态
}
return img;
}
return null; //REMOVE状态时,返回null
/*
* index=1
* 10M img=images[1] index=2 返回images[1]
* 20M img=images[2] index=3 返回images[2]
* 30M img=images[3] index=4 返回images[3]
* 40M img=images[4] index=5(REMOVE) 返回images[4]
* 50M
*/
}
/** 重写getScore()得分 */
public int getScore(){
return 1; //打掉小敌机,玩家得1分
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 301 2018-10-13 14:47 MyShoot\.classpath
文件 383 2018-10-13 14:47 MyShoot\.project
文件 598 2018-10-13 14:47 MyShoot\.settings\org.eclipse.jdt.core.prefs
文件 1467 2018-10-25 09:39 MyShoot\bin\cn\tedu\shoot\Airplane.class
文件 3575 2017-08-20 19:05 MyShoot\bin\cn\tedu\shoot\airplane0.png
文件 2619 2017-08-20 19:05 MyShoot\bin\cn\tedu\shoot\airplane1.png
文件 2954 2017-08-20 19:05 MyShoot\bin\cn\tedu\shoot\airplane2.png
文件 4047 2017-08-20 19:05 MyShoot\bin\cn\tedu\shoot\airplane3.png
文件 1439 2017-08-20 19:05 MyShoot\bin\cn\tedu\shoot\airplane4.png
文件 217 2018-10-25 09:39 MyShoot\bin\cn\tedu\shoot\Award.class
文件 26709 2017-08-20 19:05 MyShoot\bin\cn\tedu\shoot\background.png
文件 1742 2018-10-25 09:39 MyShoot\bin\cn\tedu\shoot\Bee.class
文件 6405 2017-08-20 19:05 MyShoot\bin\cn\tedu\shoot\bee0.png
文件 6416 2017-08-20 19:05 MyShoot\bin\cn\tedu\shoot\bee1.png
文件 6428 2017-08-20 19:05 MyShoot\bin\cn\tedu\shoot\bee2.png
文件 6404 2017-08-20 19:05 MyShoot\bin\cn\tedu\shoot\bee3.png
文件 6367 2017-08-20 19:05 MyShoot\bin\cn\tedu\shoot\bee4.png
文件 1476 2018-10-25 09:39 MyShoot\bin\cn\tedu\shoot\BigAirplane.class
文件 6762 2017-08-20 19:05 MyShoot\bin\cn\tedu\shoot\bigplane0.png
文件 7932 2017-08-20 19:05 MyShoot\bin\cn\tedu\shoot\bigplane1.png
文件 8682 2017-08-20 19:05 MyShoot\bin\cn\tedu\shoot\bigplane2.png
文件 9831 2017-08-20 19:05 MyShoot\bin\cn\tedu\shoot\bigplane3.png
文件 2672 2017-08-20 19:05 MyShoot\bin\cn\tedu\shoot\bigplane4.png
文件 1032 2018-10-25 09:39 MyShoot\bin\cn\tedu\shoot\Bullet.class
文件 408 2017-08-20 19:05 MyShoot\bin\cn\tedu\shoot\bullet.png
文件 130 2018-10-25 09:39 MyShoot\bin\cn\tedu\shoot\Enemy.class
文件 2559 2018-10-25 09:39 MyShoot\bin\cn\tedu\shoot\Flyingob
文件 20220 2017-08-20 19:05 MyShoot\bin\cn\tedu\shoot\gameover.png
文件 1951 2018-10-25 15:37 MyShoot\bin\cn\tedu\shoot\Hero.class
文件 12280 2017-08-20 19:05 MyShoot\bin\cn\tedu\shoot\hero0.png
............此处省略52个文件信息
- 上一篇:android:简单计算器+源码+注释
- 下一篇:基于JAVA的航空订票系统
相关资源
- Java仿微信飞机大战--Swing界面
- java开发的飞机大战项目
- Java实现飞机大战并连接数据库286128
- java实现飞机大战游戏
- 飞机大战/雷霆战机 全部Java源代码,
- 达内当当网项目源码java
- 论文+Android飞行射击游戏代码
- Java俄罗斯方块达内
- 云笔记项目---Myeclipse完整版
- 达内 Java 核心 API下_扫描版_3.04M
- 达内 Java 核心 API上_扫描版_3.05M
- 大学生实训飞机大战代码
- 达内NETCOSS电信计费系统
- 飞机大战源代码
- 飞机大战ppt
- java游戏之飞机大战
- 达内项目(云笔记)
- 飞机大战java源代码75877
- 达内java云笔记项目
- 飞机大战android版源代码
- java swing 飞机大战
- android 飞机大战游戏源码
- 达内云笔记完整版
- 达内云笔记资料note_ziliao.zip源代码c
- 微信飞机大战,JAVA版,设计完美,
- java小-飞机大战游戏
- Java飞机大战源码
- java版全民飞机大战
- 达内学子商城项目码源+静态页面
- 2018最新达内学子商城项目静态页面
评论
共有 条评论