下载资源后端资源详情
plane_wars.zip
大小:98.1MB
价格:28积分
下载量:0
评分:
5.0
上传者:m0_53267864
更新日期:2024-06-29

基于Java编写的飞机大战小游戏

资源文件列表(大概)

文件名
大小
plane_wars/.gitignore
344B
plane_wars/.idea/
-
plane_wars/.idea/.gitignore
190B
plane_wars/.idea/compiler.xml
168B
plane_wars/.idea/misc.xml
273B
plane_wars/.idea/modules.xml
267B
plane_wars/.idea/uiDesigner.xml
8.71KB
plane_wars/.idea/workspace.xml
5.07KB
plane_wars/out/
-
plane_wars/out/production/
-
plane_wars/out/production/plane_wars/
-
plane_wars/out/production/plane_wars/com/
-
plane_wars/out/production/plane_wars/com/neutech/
-
plane_wars/out/production/plane_wars/com/neutech/base/
-
plane_wars/out/production/plane_wars/com/neutech/base/Checkpoint.class
1.91KB
plane_wars/out/production/plane_wars/com/neutech/base/Constant.class
658B
plane_wars/out/production/plane_wars/com/neutech/base/Drawable.class
154B
plane_wars/out/production/plane_wars/com/neutech/base/Fire.class
127B
plane_wars/out/production/plane_wars/com/neutech/base/GameFrame$1.class
813B
plane_wars/out/production/plane_wars/com/neutech/base/GameFrame$2.class
718B
plane_wars/out/production/plane_wars/com/neutech/base/GameFrame$3.class
1.01KB
plane_wars/out/production/plane_wars/com/neutech/base/GameFrame.class
4.77KB
plane_wars/out/production/plane_wars/com/neutech/base/Movable.class
133B
plane_wars/out/production/plane_wars/com/neutech/base/Sprite.class
1.29KB
plane_wars/out/production/plane_wars/com/neutech/img/
-
plane_wars/out/production/plane_wars/com/neutech/img/bullet1.png
4.51KB
plane_wars/out/production/plane_wars/com/neutech/img/bullet2.png
4.66KB
plane_wars/out/production/plane_wars/com/neutech/img/eff1.png
71.96KB
plane_wars/out/production/plane_wars/com/neutech/img/eff2.png
89.03KB
plane_wars/out/production/plane_wars/com/neutech/img/explode1.png
2.58KB
plane_wars/out/production/plane_wars/com/neutech/img/explode2.png
5.78KB
plane_wars/out/production/plane_wars/com/neutech/img/explode3.png
13.13KB
plane_wars/out/production/plane_wars/com/neutech/img/explode4.png
18.46KB
plane_wars/out/production/plane_wars/com/neutech/img/explode5.png
17.88KB
plane_wars/out/production/plane_wars/com/neutech/img/explode6.png
13.14KB
plane_wars/out/production/plane_wars/com/neutech/img/explode7.png
8.03KB
plane_wars/out/production/plane_wars/com/neutech/img/explode8.png
4.64KB
plane_wars/out/production/plane_wars/com/neutech/img/game_over.png
325.32KB
plane_wars/out/production/plane_wars/com/neutech/img/hero.png
18.64KB
plane_wars/out/production/plane_wars/com/neutech/img/img.png
221.33KB
plane_wars/out/production/plane_wars/com/neutech/img/img_bg_level_1.jpg
387.79KB
plane_wars/out/production/plane_wars/com/neutech/img/img_bg_level_2.jpg
189.8KB
plane_wars/out/production/plane_wars/com/neutech/img/img_bg_level_3.jpg
357.93KB
plane_wars/out/production/plane_wars/com/neutech/img/img_bg_level_4.jpg
55.08KB
plane_wars/out/production/plane_wars/com/neutech/img/img_bg_level_5.jpg
74.1KB
plane_wars/out/production/plane_wars/com/neutech/img/img_plane1.png
5.94KB
plane_wars/out/production/plane_wars/com/neutech/img/img_plane2.png
5.95KB
plane_wars/out/production/plane_wars/com/neutech/img/img_plane3.png
5.91KB
plane_wars/out/production/plane_wars/com/neutech/img/img_plane4.png
5.47KB
plane_wars/out/production/plane_wars/com/neutech/music/
-
plane_wars/out/production/plane_wars/com/neutech/music/bg.wav
50.61MB
plane_wars/out/production/plane_wars/com/neutech/runtime/
-
plane_wars/out/production/plane_wars/com/neutech/runtime/Blood.class
1.13KB
plane_wars/out/production/plane_wars/com/neutech/runtime/Enemy.class
2.52KB
plane_wars/out/production/plane_wars/com/neutech/runtime/EnemyBullet.class
1.68KB
plane_wars/out/production/plane_wars/com/neutech/runtime/Explode.class
1.89KB
plane_wars/out/production/plane_wars/com/neutech/runtime/GameOver.class
1.08KB
plane_wars/out/production/plane_wars/com/neutech/runtime/Map.class
1.49KB
plane_wars/out/production/plane_wars/com/neutech/runtime/Plane.class
2.64KB
plane_wars/out/production/plane_wars/com/neutech/runtime/PlaneBullet.class
1.66KB
plane_wars/out/production/plane_wars/com/neutech/runtime/Score.class
2.39KB
plane_wars/out/production/plane_wars/com/neutech/start.class
1.25KB
plane_wars/out/production/plane_wars/com/neutech/util/
-
plane_wars/out/production/plane_wars/com/neutech/util/Map/
-
plane_wars/out/production/plane_wars/com/neutech/util/Map/DisposeLevel.class
1.18KB
plane_wars/out/production/plane_wars/com/neutech/util/Map/ImageUtils.class
2.29KB
plane_wars/plane_wars.iml
433B
plane_wars/src/
-
plane_wars/src/com/
-
plane_wars/src/com/neutech/
-
plane_wars/src/com/neutech/base/
-
plane_wars/src/com/neutech/base/Checkpoint.java
1.22KB
plane_wars/src/com/neutech/base/Constant.java
656B
plane_wars/src/com/neutech/base/Drawable.java
124B
plane_wars/src/com/neutech/base/Fire.java
82B
plane_wars/src/com/neutech/base/GameFrame.java
6.02KB
plane_wars/src/com/neutech/base/Movable.java
78B
plane_wars/src/com/neutech/base/Sprite.java
1018B
plane_wars/src/com/neutech/img/
-
plane_wars/src/com/neutech/img/bullet1.png
4.51KB
plane_wars/src/com/neutech/img/bullet2.png
4.66KB
plane_wars/src/com/neutech/img/eff1.png
71.96KB
plane_wars/src/com/neutech/img/eff2.png
89.03KB
plane_wars/src/com/neutech/img/explode1.png
2.58KB
plane_wars/src/com/neutech/img/explode2.png
5.78KB
plane_wars/src/com/neutech/img/explode3.png
13.13KB
plane_wars/src/com/neutech/img/explode4.png
18.46KB
plane_wars/src/com/neutech/img/explode5.png
17.88KB
plane_wars/src/com/neutech/img/explode6.png
13.14KB
plane_wars/src/com/neutech/img/explode7.png
8.03KB
plane_wars/src/com/neutech/img/explode8.png
4.64KB
plane_wars/src/com/neutech/img/game_over.png
325.32KB
plane_wars/src/com/neutech/img/hero.png
18.64KB
plane_wars/src/com/neutech/img/img.png
221.33KB
plane_wars/src/com/neutech/img/img_bg_level_1.jpg
387.79KB
plane_wars/src/com/neutech/img/img_bg_level_2.jpg
189.8KB
plane_wars/src/com/neutech/img/img_bg_level_3.jpg
357.93KB
plane_wars/src/com/neutech/img/img_bg_level_4.jpg
55.08KB
plane_wars/src/com/neutech/img/img_bg_level_5.jpg
74.1KB
plane_wars/src/com/neutech/img/img_plane1.png
5.94KB
plane_wars/src/com/neutech/img/img_plane2.png
5.95KB
plane_wars/src/com/neutech/img/img_plane3.png
5.91KB
plane_wars/src/com/neutech/img/img_plane4.png
5.47KB
plane_wars/src/com/neutech/music/
-
plane_wars/src/com/neutech/music/bg.wav
50.61MB
plane_wars/src/com/neutech/runtime/
-
plane_wars/src/com/neutech/runtime/Blood.java
740B
plane_wars/src/com/neutech/runtime/Enemy.java
1.54KB
plane_wars/src/com/neutech/runtime/EnemyBullet.java
1.17KB
plane_wars/src/com/neutech/runtime/Explode.java
1.14KB
plane_wars/src/com/neutech/runtime/GameOver.java
703B
plane_wars/src/com/neutech/runtime/Map.java
1018B
plane_wars/src/com/neutech/runtime/Plane.java
3.19KB
plane_wars/src/com/neutech/runtime/PlaneBullet.java
1.08KB
plane_wars/src/com/neutech/runtime/Score.java
1.53KB
plane_wars/src/com/neutech/start.java
683B
plane_wars/src/com/neutech/util/
-
plane_wars/src/com/neutech/util/Map/
-
plane_wars/src/com/neutech/util/Map/DisposeLevel.java
625B
plane_wars/src/com/neutech/util/Map/ImageUtils.java
1.55KB

资源内容介绍

基于Java编写的飞机大战小游戏
package com.neutech.base;import com.neutech.runtime.*;import com.neutech.util.Map.DisposeLevel;import java.awt.*;import java.awt.event.KeyAdapter;import java.awt.event.KeyEvent;import java.awt.event.WindowAdapter;import java.awt.event.WindowEvent;import java.util.List;import java.util.concurrent.CopyOnWriteArrayList;public class GameFrame extends Frame { public GameFrame() { init(); } private void init() {// 设置屏幕的大小 setSize(Constant.WINDOW_OUTER_WIDTH,Constant.WINDOW_OUTER_HEIGHT);// 设置居中 setLocationRelativeTo(null);// 不允许改变屏幕大小 setResizable(false);// 屏蔽输入法 enableInputMethods(false);// 设置显示 setVisible(true);// 启动一个线程定时刷新窗口 new Thread() { public void run(){ while (true) { repaint(); try { Thread.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } } } }.start();// 添加一个窗口监听事件,用来实现窗口关闭 addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) {// 关虚拟机 System.exit(0); } }); addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if(e.getKeyCode()==KeyEvent.VK_SPACE) { Constant.execute=!Constant.execute; } else { plane.keyPressed(e); } } public void keyReleased(KeyEvent e) { plane.keyReleased(e); } }); }// 等级处理 DisposeLevel disposeLevel=new DisposeLevel();// 上面的地图 Map map1=new Map(-Constant.WINDOW_OUTER_HEIGHT);// 下面的地图 Map map2=new Map(0);// 分数 Score score=new Score();// 飞机 Plane plane=new Plane();// 飞机子弹集合 public List<PlaneBullet> planeBulletList =new CopyOnWriteArrayList<>();// 敌机集合 public List<Enemy> enemyList=new CopyOnWriteArrayList<>();// 敌机子弹集合 public List<EnemyBullet> enemyBulletList=new CopyOnWriteArrayList<>();// 爆炸效果集合 public List<Explode> explodeList=new CopyOnWriteArrayList<>();// 血条 Blood blood=new Blood(); @Override public void paint(Graphics g) { if(Constant.execute) { map1.move(); map2.move(); map1.draw(g); map2.draw(g); plane.move(); plane.draw(g); plane.fire();// 遍历飞机的子弹 for (PlaneBullet planeBullet : planeBulletList) { planeBullet.move(); planeBullet.draw(g); }// 遍历敌机 for (Enemy enemy:enemyList) { enemy.move(); enemy.draw(g); enemy.fire(); }// 遍历敌机的子弹 for (EnemyBullet enemyBullet:enemyBulletList) { enemyBullet.move(); enemyBullet.draw(g); }// 分数 score.draw(g); score.create();// 我方子弹与敌机的碰撞检测 for (PlaneBullet planeBullet : planeBulletList) { for (Enemy enemy:enemyList) { if(planeBullet.creatRectangle().intersects(enemy.creatRectangle())) {// 从集合中清除子弹和敌机 planeBulletList.remove(planeBullet); enemyList.remove(enemy);// 分数+1 score.setNumber(score.getNumber()+1); // 爆炸效果 explodeList.add(new Explode(enemy.getX(),enemy.getY())); } } }// 我方飞机与敌机碰撞检测 for(Enemy enemy:enemyList){ if(plane.creatRectangle().intersects(enemy.creatRectangle())) {// 移除敌机 enemyList.remove(enemy); // 爆炸效果 explodeList.add(new Explode(enemy.getX(),enemy.getY()));// 血条-1 blood.setWidth(blood.getWidth()-20); blood.setX(blood.getX()+20); } }// 遍历爆炸效果 for (Explode explode:explodeList) { explode.draw(g); }// 敌方子弹与我方飞机的碰撞检测 for (EnemyBullet enemyBullet : enemyBulletList) { if(plane.creatRectangle().intersects(enemyBullet.creatRectangle())) {// 移除子弹 enemyBulletList.remove(enemyBullet);// 血条-1 blood.setWidth(blood.getWidth()-20); blood.setX(blood.getX()+20); } } g.setColor(Color.GRAY); g.fillRoundRect(400,40,100,30, 10, 10); blood.draw(g); } } public Image offScreenImage=null; public void update(Graphics g){ if (offScreenImage==null) { offScreenImage=this.createImage(Constant.WINDOW_OUTER_WIDTH,Constant.WINDOW_OUTER_HEIGHT); } Graphics gOff=offScreenImage.getGraphics(); paint(gOff); g.drawImage(offScreenImage,0,0,null); }}

用户评论 (0)

发表评论

captcha

相关资源

安康旅游网站 JAVA+Vue.js+SpringBoot+MySQL

基于Vue.js和SpringBoot的安康旅游网站,分为管理后台和用户网页端,可以给管理员、游客角色使用,包括景点信息、省市信息、旅游线路、特产管理、购票订单模块和系统基础模块,项目编号T098。项目录屏:https://www.bilibili.com/video/BV1Hx421y7gn启动教程:https://www.bilibili.com/video/BV1pW4y1P7GR项目讲解视频:https://space.bilibili.com/417412814/channel/collectiondetail?sid=2242844

53.17MB36积分

酒店客房管理系统 JAVA+Vue.js+SpringBoot+MySQL

基于Vue.js和SpringBoot的酒店客房管理系统,分为管理后台和用户网页端,可以给管理员、会员角色使用,包括会员管理、清洁工管理、客房管理、用户预约、用户入住模块和系统基础模块,项目编号T099。项目录屏:https://www.bilibili.com/video/BV1Kz421Q7m3启动教程:https://www.bilibili.com/video/BV1pW4y1P7GR项目讲解视频:https://space.bilibili.com/417412814/channel/collectiondetail?sid=2242844

39.36MB21积分

学生宿舍信息系统 JAVA+Vue.js+SpringBoot+MySQL

基于Vue.js和SpringBoot的学生宿舍信息系统,分为管理后台和用户网页端,可以给管理员、学生角色使用,包括宿舍安排、宿舍报修、假期留宿、宿舍缴费模块和系统基础模块,项目编号T100。项目录屏:https://www.bilibili.com/video/BV1r2421K7pT启动教程:https://www.bilibili.com/video/BV1pW4y1P7GR项目讲解视频:https://space.bilibili.com/417412814/channel/collectiondetail?sid=2242844

38.84MB33积分

ManufacturerDatautility.zip

111

1.99KB31积分