飞机大战中集团战有多少档的得分用途

全民飞机大战怎样抽到得分加成20%以上呢?_百度知道
全民飞机大战怎样抽到得分加成20%以上呢?
答题抽奖
首次认真答题后
即可获得3次抽奖机会,100%中奖。
寕静而致远知道合伙人
寕静而致远
采纳数:834
获赞数:12551
得分加成这个东西是看运气的,不能强求想要分数打了高,你必须要有一架5星战机(机动、神鹰都是非RMB玩家不错的选择)1命不复活200W+的玩家在飞机大战里只能算是中上水平,目前的最高水准分数在600W+,一命不复活完成对于新手来说第9关是一个砍,过了第9关后11~15关又会是一个砍,本人手残目前卡在17~20这个砍上(最高177W),当然这个是1命不复活的成绩给你的建议:1、拥有一架5星战机并升到满级2、非RMB玩家用悟空+呆呆龙,不过这对组合最好是用机动悍将3、每周花150钻购买巅峰飞跃,即便你0金币起点,10天后即可拥有机动悍将钻石怎么赚?一周完成前3个任务+7天登陆的60钻刚好是151钻,有了巅峰飞跃你可以轻松把每日的金币打到上限。
流年裏的温柔知道合伙人
流年裏的温柔
采纳数:50
获赞数:176
擅长:暂未定制
最高就只有加成20%没有更高了!
打到200多万的朋友是怎么打的…?
不断复活!
我60级凤凰,顶多打100W再高就上不去了!也是我技术不行!
我试过最多3次不是吗?打不到的?
有技术好的,我朋友30J甜心战神,都能打80W
为你推荐:
其他类似问题
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。& & 当前位置
全民飞机大战如何刷高分 得分计算方法详解
iPhone/iPad
腾讯为微信和手机QQ用户打造的休闲飞行射击类手机游戏!快来玩吧!...
以清新明快的卡通风格呈现精美游戏画面,带来自由飞翔的激爽感觉。...
& & & &全民飞机大战是一款非常好玩的飞行射击游戏,丰富的关卡与款选的战机吸引着玩家。全民飞机大战如何刷高分呢?玩家除了可以通过辅助刷分外,在平时游戏中掌握得分的技巧也可以刷到高分。下面小编就给大家带来全民飞机大战得分计算方法,了解这些之后玩家就能不断刷新自己的得分纪录。& & & &首先我们要知道《全民飞机大战》的得分算法公式是:最终得分=死亡时得分*(1+宠物加成+等级加成+道具加成)下面我们就来一一解释公式里面的内容。& & & &宠物加成& & & &在使用宠物出战时我们都可以获得宠物分数加成,但是官方并没有给出宠物加成的比例,我们不妨通过简单的运算来推出宠物加成比例。在不使用道具加成的前提下使用下这个公式:& & & &最终得分 = 死亡时得分*(1+宠物加成+等级加成)& & & &再由上面的公式变换得出:& & & &宠物加成 =(最终得分/死亡时得分)- 1 - 等级加成& & & &以上就是小编给大家带来的全民飞机大战得分加成公式,希望对大家有所帮助,更多游戏攻略请大家关注7K全民飞机大战攻略站。
《全民飞机大战》游戏下载分类:休闲竞技
《全民飞机大战》独家礼包微信扫一扫,或搜索微信公众账号:7K7K手游7K7K手游官方Q群(0337909)
责任编辑:7k7k
··········
24小时更新
··········
················
新游戏评测
驯龙战机3D是一款飞行射击类手游,在游戏中飞龙是玩家的重要战斗伙伴,拥有一条好的飞龙能够让大家挑战关卡轻松很多,很多飞龙都是需要大家解锁来获得的,下面小编给大家主要讲
天天酷跑孔雀灵王是小伙伴们非常期待的ss神宠,小伙伴们都在等待它的上架,那么它的属性和技能大家了解吗?下面小爱哦吧给大家带来了天天酷跑超强神宠孔雀灵王属性技能讲解,感
乱斗西游排行榜是小伙伴们非常喜欢的玩法,很多小伙伴都在不断的冲击排行榜,那么在排行榜中我们要如何搭配呢?下面小编给大家带来了乱斗西游排行榜最强搭配组合推荐,感兴趣的
今天7k7k小编为大家带来的最新消息,天天风之旅S级宠物土豪卷纸来了~腾讯首款3D轻动作跑酷手游《天天风之旅》于10月31日喜迎双平台上线。在迎来iOS小伙伴们的同时,最受欢迎的“土
今天7k7k小编为大家带来的是天天风之旅的角色介绍,下面是天天风之旅忍者的详细玩法介绍,希望大家可以喜欢。天天风之旅是一款腾讯自研的3D轻动作跑酷手游。在传统的跑酷游戏基
爱养成2是一款美少女养成游戏,一改前作俏皮的风格,续作把故事设定在降魔师与魔王的时代。而在本作中,玩家也不需要再顶着大叔的头像,而是可以自行选择性别,这对于喜爱《爱
《糖果粉碎苏打传奇》增加了不少适合夏天品尝的甜点,比如说苏打和果冻等等,玩法也因此发生了改变,更加缤纷的色彩和口味,难度却不降反升,“糖果粉碎”系列仍然保留了以甜
Rainblocks《雨滴方块》这个复古像素风的小游戏,就是一个精简版的九宫格游戏,在一定程度上简化了玩法,又通过各种小道具的设置来丰富游戏的趣味性,实是一个令人上瘾的小游戏。
通过360安全认证&>&java微信版飞机大战
java微信版飞机大战
上传大小:452KB
用java实现的“微信版飞机大战”游戏,击中敌机即可得分,达到一定分数即可进入下一关(速度更快),撞到敌机游戏结束!
综合评分:5
{%username%}回复{%com_username%}{%time%}\
/*点击出现回复框*/
$(".respond_btn").on("click", function (e) {
$(this).parents(".rightLi").children(".respond_box").show();
e.stopPropagation();
$(".cancel_res").on("click", function (e) {
$(this).parents(".res_b").siblings(".res_area").val("");
$(this).parents(".respond_box").hide();
e.stopPropagation();
/*删除评论*/
$(".del_comment_c").on("click", function (e) {
var id = $(e.target).attr("id");
$.getJSON('/index.php/comment/do_invalid/' + id,
function (data) {
if (data.succ == 1) {
$(e.target).parents(".conLi").remove();
alert(data.msg);
$(".res_btn").click(function (e) {
var parentWrap = $(this).parents(".respond_box"),
q = parentWrap.find(".form1").serializeArray(),
resStr = $.trim(parentWrap.find(".res_area_r").val());
console.log(q);
//var res_area_r = $.trim($(".res_area_r").val());
if (resStr == '') {
$(".res_text").css({color: "red"});
$.post("/index.php/comment/do_comment_reply/", q,
function (data) {
if (data.succ == 1) {
var $target,
evt = e || window.
$target = $(evt.target || evt.srcElement);
var $dd = $target.parents('dd');
var $wrapReply = $dd.find('.respond_box');
console.log($wrapReply);
//var mess = $(".res_area_r").val();
var mess = resS
var str = str.replace(/{%header%}/g, data.header)
.replace(/{%href%}/g, 'http://' + window.location.host + '/user/' + data.username)
.replace(/{%username%}/g, data.username)
.replace(/{%com_username%}/g, data.com_username)
.replace(/{%time%}/g, data.time)
.replace(/{%id%}/g, data.id)
.replace(/{%mess%}/g, mess);
$dd.after(str);
$(".respond_box").hide();
$(".res_area_r").val("");
$(".res_area").val("");
$wrapReply.hide();
alert(data.msg);
}, "json");
/*删除回复*/
$(".rightLi").on("click", '.del_comment_r', function (e) {
var id = $(e.target).attr("id");
$.getJSON('/index.php/comment/do_comment_del/' + id,
function (data) {
if (data.succ == 1) {
$(e.target).parent().parent().parent().parent().parent().remove();
$(e.target).parents('.res_list').remove()
alert(data.msg);
//填充回复
function KeyP(v) {
var parentWrap = $(v).parents(".respond_box");
parentWrap.find(".res_area_r").val($.trim(parentWrap.find(".res_area").val()));
评论共有6条
不错,很好的素材
完整运行,代码注释也比较多,初学者看起来比较方便,易懂
太棒了 直接导入就可以用了 而且有图片素材
综合评分:
积分/C币:3
综合评分:
积分/C币:5
白菜白菜我是萝卜
综合评分:
积分/C币:5
VIP会员动态
热门资源标签
CSDN下载频道资源及相关规则调整公告V11.10
下载频道用户反馈专区
下载频道积分规则调整V1710.18
spring mvc+mybatis+mysql+maven+bootstrap 整合实现增删查改简单实例.zip
资源所需积分/C币
当前拥有积分
当前拥有C币
输入下载码
为了良好体验,不建议使用迅雷下载
java微信版飞机大战
会员到期时间:
剩余下载个数:
剩余积分:0
为了良好体验,不建议使用迅雷下载
积分不足!
资源所需积分/C币
当前拥有积分
您可以选择
程序员的必选
绿色安全资源
资源所需积分/C币
当前拥有积分
当前拥有C币
为了良好体验,不建议使用迅雷下载
资源所需积分/C币
当前拥有积分
当前拥有C币
为了良好体验,不建议使用迅雷下载
资源所需积分/C币
当前拥有积分
当前拥有C币
您的积分不足,将扣除 10 C币
为了良好体验,不建议使用迅雷下载
无法举报自己的资源
你当前的下载分为234。
你还不是VIP会员
开通VIP会员权限,免积分下载
你下载资源过于频繁,请输入验证码
您因违反CSDN下载频道规则而被锁定帐户,如有疑问,请联络:!
若举报审核通过,可返还被扣除的积分
被举报人:
请选择类型
资源无法下载 ( 404页面、下载失败、资源本身问题)
资源无法使用 (文件损坏、内容缺失、题文不符)
侵犯版权资源 (侵犯公司或个人版权)
虚假资源 (恶意欺诈、刷分资源)
含色情、危害国家安全内容
含广告、木马病毒资源
*投诉人姓名:
*投诉人联系方式:
*版权证明:
*详细原因:
java微信版飞机大战您的当前位置: > 正文
全民飞机大战得分加成计算详解,今天小编让所有机友都可以很清楚了解怎么计算得分,今天让所有机友都可以很快速的计算出得分加成,让所有机友都可以很方便的计算出得分加成。接下来,我们重述得分计算全过程(含双打计算),并罗列所有得分加成项,详解所有得分加成,最终公式化得分计算。一起看看把。
(单打和双打计算公式在最后,如果对得分计算很了解,只要公式的,可以直接拉到文尾拿公式便好)。
计算得分,无非就是计算&加成系数&我们得先明白这个简单公式:加成系数=所有加成+1结算分=裸分*加成系数裸分=结算分/加成系数。
计算方法有两种。我们先来看最简单的这种(当然,也是缺点最多的)我们进经典模式随意飞一局,死亡时记住裸分,用它除结算分,就得到加成系数。来看个例子:
从中我们可以很轻松计算出加成系数为,这表示我们如果打3000万裸分,结算分就是=6024万。反之,如果我们想打8000万的分数,那必须达到的裸分是=3984万
这种方法最简单,但缺点也很明显。一是影响加成的任意一项改变,又要重新计算系数;二是更换队友又要重新计算。所以,有心的机友,还是应该先完全了解加成系数的计算,做个记录,这样以后无论装备、队友怎么变化,都可以随时秒算得分。
接下来介绍第二种方法,也是最原始最常规的方法。在详细了解计算全过程之前,我们先来看一张表格,这张表格是飘哥平时算分用的,只要在黄色区域输入裸分或希望的最终得分,会马上跳出对应的得分或需要的裸分。这张表格中,把影响得分计算的分成9类,分别是&等级加成、装备加成、天神祝福、宠物自身、宠物隐藏、宠物技能、套装技能、飞机加成、飞行团加成&这9项之和,就是最终的加成系数。
&套装技能&,目前能影响这项得分的只有羊的6%、猴的8%以及深渊的5%。再解释为何这么排序。前5项都是单独加分,后4项会影响队友加成。Java实现飞机大战-连接数据库并把得分写入数据库
&更新时间:日 08:21:11 & 作者:南乔代码Cool
这篇文章给大家分享了Java实现飞机大战中连接数据库并把得分写入数据库的相关知识点和代码,有兴趣的可以学习参考下。
编写飞行物类
package com.tarena.
import java.awt.image.BufferedI
* 飞行物(敌机,蜜蜂,子弹,英雄机)
public abstract class FlyingObject {
protected BufferedI
protected BufferedImage[]
public int getX() {
public void setX(int x) {
public int getY() {
public void setY(int y) {
public int getWidth() {
public void setWidth(int width) {
this.width =
public int getHeight() {
public void setHeight(int height) {
this.height =
public BufferedImage getImage() {
public void setImage(BufferedImage image) {
this.image =
* 检查是否出界
* @param width 边界宽
* @param height 边界高
* @return true 出界与否
public abstract boolean outOfBounds();
* 飞行物移动一步
public abstract void step();
* 检查当前飞行物体是否被子弹(x,y)击(shoot)中,
* true表示击中,飞行物可以被击中
* @param Bullet 子弹对象
* @return true表示被击中了
public boolean shootBy(Bullet bullet){
if(bullet.isBomb()){
int x = bullet.x; //子弹横坐标
int y = bullet.y; //子弹纵坐标
boolean shoot = this.x&x && x&this.x+width && this.y&y && y&this.y+
if(shoot){
bullet.setBomb(true);
编写飞机类
package com.tarena.
* 敌飞机: 是飞行物,也是敌人
public class Airplane extends FlyingObject implements Enemy {
int speed = 2; //移动步骤
public Airplane(){
this.image = ShootGame.
this.ember = ShootGame.airplaneE
width = image.getWidth();
height = image.getHeight();
x = (int)(Math.random()*(ShootGame.WIDTH - width));
public int getScore() { //获取分数
boolean outOfBounds() { //越界处理
return y&ShootGame.HEIGHT;
public void step() { //移动
编写奖励接口
package com.tarena.
public interface Award {
int DOUBLE_FIRE = 0; //双倍火力
int LIFE = 1;
/** 获得奖励类型(上面的0或1) */
int getType();
编写蜜蜂类
package com.tarena.
import java.util.R
public class Bee extends FlyingObject implements Award{
private int xSpeed = 1;
private int ySpeed = 2;
private int awardT
public Bee(){
this.image = ShootGame.
this.ember = ShootGame.beeE
width = image.getWidth();
height = image.getHeight();
Random rand = new Random();
x = rand.nextInt(ShootGame.WIDTH - width);
awardType = rand.nextInt(2);
//初始化时给奖励
public int getType(){
return awardT
public boolean outOfBounds() {
return y&ShootGame.HEIGHT;
public void step() {
if(x & ShootGame.WIDTH-width){
xSpeed = -1;
if(x & 0){
xSpeed = 1;
编写大飞机类
package com.tarena.
import java.util.R
public class BigPlane extends FlyingObject
implements Enemy, Award{
private int xSpeed=1;
private int ySpeed=1;
private int awardT
public BigPlane() {
this.image = ShootGame.bigP
this.ember = ShootGame.bigPlaneE
width = image.getWidth();
height = image.getHeight();
Random rand = new Random();
x = rand.nextInt(ShootGame.WIDTH - width);
awardType = rand.nextInt(2);
public int getType() {
return awardT
public int getScore() {
return 50;
public boolean outOfBounds() {
// @Override
// public BufferedImage getImage() {
Graphics g = image.getGraphics();
g.setColor(Color.white);
g.fillRect(0, 0, 40, 30);
g.setColor(Color.black);
g.drawString("L:"+life, 10, 20);
public EnemyBullet[] shoot() { // 发射子弹
int xStep = width / 4; // 子弹步分为飞机宽度4半
int yStep = 20;
EnemyBullet[] bullets2 = new EnemyBullet[1];
bullets2[0] = new EnemyBullet(x + 2 * xStep, y - yStep);
return bullets2;
public void step() {
if(x & ShootGame.WIDTH-width){
xSpeed = -1;
if(x & 0){
xSpeed = 1;
public boolean shootBy(Bullet bullet) {
if(super.shootBy(bullet)){
return life==0;
编写子弹类
package com.tarena.
public class Bullet extends FlyingObject {
private int speed = 3; //移动的速度
public Bullet(int x,int y){
this.image = ShootGame.
public void setBomb(boolean bomb) {
this.bomb =
public boolean isBomb() {
public void step(){
//移动方法
public boolean outOfBounds() {
return y&-
编写飞机爆炸效果
package com.tarena.
import java.awt.image.BufferedI
* 灰烬 飞机被打掉以后的残影
* @author Robin
public class Ember {
private BufferedImage[] images={};
private BufferedI
private int intevel = 10;
private int x,y;
public Ember(FlyingObject object) {
images = object.
image = object.
x = object.x;
y = object.y;
index = 0;
public boolean burnDown(){
if(i%intevel==0){
if(index == images.length){
image = images[index++];
public int getX() {
public int getY() {
public BufferedImage getImage() {
编写敌人类
package com.tarena.
* 敌人,可以有分数
public interface Enemy {
//敌人的分数
int getScore();
编写敌机子弹类
package com.tarena.
public class EnemyBullet extends FlyingObject {
private int speed = 2; //移动的速度
public EnemyBullet(int x,int y){
this.image = ShootGame.EnemyB
public void setBomb(boolean bomb) {
this.bomb =
public boolean isBomb() {
public void step(){
//移动方法
public boolean outOfBounds() {
return y&-
编写英雄机类
package com.tarena.
import java.awt.image.BufferedI
* @author Administrator
public class Hero extends FlyingObject {
protected BufferedImage[] images = {};
protected int index = 0;
//private boolean doubleF
private int doubleF
public Hero() {
doubleFire = 0;
this.image = ShootGame.hero0;
this.ember = ShootGame.heroE
images = new BufferedImage[]{ShootGame.hero0, ShootGame.hero1};
width = image.getWidth();
height = image.getHeight();
public int isDoubleFire() {
return doubleF
public void addDoubleFire(){
doubleFire = 40;
public void setDoubleFire(int doubleFire) {
this.doubleFire = doubleF
public void addLife() { // 增命
public void subtractLife() { // 减命
public int getLife() {
* 当前物体移动了一下,相对距离, x,y鼠标位置
public void moveTo(int x, int y) {
this.x = x - width / 2;
this.y = y - height / 2;
public boolean outOfBounds() {
return x & 0 || x & ShootGame.WIDTH - width || y & 0
|| y & ShootGame.HEIGHT -
public Bullet[] shoot() { // 发射子弹
int xStep = width / 4; // 子弹步分为飞机宽度4半
int yStep = 20;
if (doubleFire&0) {
Bullet[] bullets = new Bullet[2];
bullets[0] = new Bullet(x + xStep, y - yStep);
bullets[1] = new Bullet(x + 3 * xStep, y - yStep);
doubleFire -= 2;
} else { // 单倍
Bullet[] bullets = new Bullet[1];
bullets[0] = new Bullet(x + 2 * xStep, y - yStep); // y-yStep(子弹距飞机的位置)
public void step() {
if(images.length&0){
image = images[index++/10%images.length];
public boolean hit(FlyingObject other) { // 碰撞算法
int x1 = other.x - this.width / 2;
int x2 = other.x + other.width + this.width / 2;
int y1 = other.y - this.height / 2;
int y2 = other.y + other.height + this.height / 2;
return this.x + this.width / 2 & x1 && this.x + this.width / 2 & x2
&& this.y + this.height / 2 & y1
&& this.y + this.width / 2 & y2;
public boolean hit2(EnemyBullet bb1) {
int x1 = bb1.x - this.width / 2;
int x2 = bb1.x + bb1.width + this.width / 2;
int y1 = bb1.y - this.height / 2;
int y2 = bb1.y + bb1.height + this.height / 2;
int hx = this.x + this.width / 2;
int hy = this.y + this.height / 2;
return hx & x1 && hx & x2 && hy & y1 && hy & y2;
package com.tarena.
import java.applet.A
import java.applet.AudioC
import java.io.F
import java.net.URI;
import java.net.URL;
import javax.swing.JF
public class Sound extends JFrame{
f = new File("C:\\Users\\姜涛\\Desktop\\dddd\\StudioEIM - MapleStory.wav");
uri = f.toURI();
url = uri.toURL(); //解析地址
aau = Applet.newAudioClip(url);
aau.loop(); //循环播放
} catch (Exception e)
{ e.printStackTrace();
package com.tarena.
import java.awt.C
import java.awt.F
import java.awt.G
import java.awt.event.MouseA
import java.awt.event.MouseE
import java.awt.image.BufferedI
import java.util.A
import java.util.R
import java.util.T
import java.util.TimerT
import javax.imageio.ImageIO;
import javax.swing.ImageI
import javax.swing.JF
import javax.swing.JP
import DAO.DAO;
public class ShootGame extends JPanel {
public static final int WIDTH = 400; // 面板宽
public static final int HEIGHT = 654; // 面板高
/** 游戏的当前状态: START RUNNING PAUSE GAME_OVER */
public static final int START = 0;
public static final int RUNNING = 1;
public static final int PAUSE = 2;
public static final int GAME_OVER = 3;
private int score = 0; // 得分
private T // 定时器
private int intervel = ; // 时间间隔(毫秒)
public static BufferedI
public static BufferedI
public static BufferedI
public static BufferedI
public static BufferedI
public static BufferedI
public static BufferedImage EnemyB
public static BufferedImage[] airplaneEmber=new BufferedImage[4];
public static BufferedI
public static BufferedImage[] beeEmber=new BufferedImage[4];;
public static BufferedImage hero0;
public static BufferedImage hero1;
public static BufferedImage[] heroEmber=new BufferedImage[4];;
public static BufferedImage bigP
public static BufferedImage[] bigPlaneEmber=new BufferedImage[4];;
private FlyingObject[] flyings = {}; // 敌机数组
private Bullet[] bullets = {}; // 子弹数组
private EnemyBullet[] bullets2 = {};//敌机子弹数组
private Hero hero = new Hero(); // 英雄机
private Ember[] embers = {}; // 灰烬
private BigPlane bigplane=new BigPlane();
static {// 静态代码块
background = ImageIO.read(ShootGame.class
.getResource("background.png"));
bigPlane = ImageIO
.read(ShootGame.class.getResource("bigplane.png"));
airplane = ImageIO
.read(ShootGame.class.getResource("airplane.png"));
bee = ImageIO.read(ShootGame.class.getResource("bee.png"));
bullet = ImageIO.read(ShootGame.class.getResource("bullet.png"));
hero0 = ImageIO.read(ShootGame.class.getResource("hero0.png"));
hero1 = ImageIO.read(ShootGame.class.getResource("hero1.png"));
pause = ImageIO.read(ShootGame.class.getResource("pause.png"));
EnemyBullet= ImageIO.read(ShootGame.class.getResource("EnemyBullet.png"));
gameover = ImageIO
.read(ShootGame.class.getResource("gameover.png"));
start = ImageIO
.read(ShootGame.class.getResource("start.png"));
for(int i=0; i&4; i++){
beeEmber[i] = ImageIO.read(
ShootGame.class.getResource("bee_ember"+i+".png"));
airplaneEmber[i] = ImageIO.read(
ShootGame.class.getResource("airplane_ember"+i+".png"));
bigPlaneEmber[i] = ImageIO.read(
ShootGame.class.getResource("bigplane_ember"+i+".png"));
heroEmber[i] = ImageIO.read(
ShootGame.class.getResource("hero_ember"+i+".png"));
} catch (Exception e) {
e.printStackTrace();
public void paint(Graphics g) {
g.drawImage(background, 0, 0, null); // 画背景图
paintEmber(g);
paintHero(g); // 画英雄机
paintBullets(g); // 画子弹
paintFlyingObjects(g); // 画飞行物
paintScore(g); // 画分数
paintState(g); // 画游戏状态
paintEnemyBullets(g);//画敌机子弹
/** 画英雄机 */
public void paintHero(Graphics g) {
g.drawImage(hero.getImage(), hero.getX(), hero.getY(), null);
public void paintEmber(Graphics g) {
for (int i = 0; i & embers. i++) {
Ember e = embers[i];
g.drawImage(e.getImage(), e.getX(), e.getY(), null);
/** 画子弹 */
public void paintBullets(Graphics g) {
for (int i = 0; i & bullets. i++) {
Bullet b = bullets[i];
if(! b.isBomb())
g.drawImage(b.getImage(), b.getX() - b.getWidth() / 2, b.getY(),
public void paintEnemyBullets(Graphics g) {
for(int i=0;i&bullets2.i++) {
EnemyBullet e=bullets2[i];
if(! e.isBomb()) {
g.drawImage(e.getImage(),e.getX() - e.getWidth() / 2, e.getY(),null);
/** 画飞行物 */
public void paintFlyingObjects(Graphics g) {
for (int i = 0; i & flyings. i++) {
FlyingObject f = flyings[i];
g.drawImage(f.getImage(), f.getX(), f.getY(), null);
/** 画分数 */
public void paintScore(Graphics g) {
int x = 10;
int y = 25;
Font font = new Font(Font.SANS_SERIF,Font.BOLD, 14);
g.setColor(new Color(0xFFFFFF));
g.setFont(font); // 设置字体
g.drawString("SCORE:" + score, x, y); // 画分数
g.drawString("LIFE:" + hero.getLife(), x, y);
/** 画游戏状态 */
public void paintState(Graphics g) {
switch (state) {
case START:
g.drawImage(start, 0, 0, null);
case PAUSE:
g.drawImage(pause, 0, 0, null);
case GAME_OVER:
g.drawImage(gameover, 0, 0, null);
public static void main(String[] args) {
new Sound();
JFrame frame = new JFrame("Shoot Game");
ShootGame game = new ShootGame(); // 面板对象
frame.add(game); // 将面板添加到JFrame中
frame.setSize(WIDTH, HEIGHT); // 大小
frame.setAlwaysOnTop(true); // 其总在最上
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // 默认关闭操作
frame.setIconImage(new ImageIcon("images/icon.jpg").getImage()); // 设置窗体的图标
frame.setLocationRelativeTo(null); // 设置窗体初始位置
frame.setVisible(true); // 尽快调用paint
game.action(); // 启动执行
public void action() { // 启动执行代码
// 鼠标监听事件
MouseAdapter l = new MouseAdapter() {
public void mouseMoved(MouseEvent e) { // 鼠标移动
if (state == RUNNING) { // 运行时移动英雄机
int x = e.getX();
int y = e.getY();
hero.moveTo(x, y);
public void mouseEntered(MouseEvent e) { // 鼠标进入
if (state == PAUSE) { // 暂停时运行
state = RUNNING;
public void mouseExited(MouseEvent e) { // 鼠标退出
if (state != GAME_OVER) {
state = PAUSE; // 游戏未结束,则设置其为暂停
public void mouseClicked(MouseEvent e) { // 鼠标点击
switch (state) {
case START:
state = RUNNING;
case GAME_OVER: // 游戏结束,清理现场
flyings = new FlyingObject[0];
bullets = new Bullet[0];
hero = new Hero();
score = 0;
state = START;
this.addMouseListener(l); // 处理鼠标点击操作
this.addMouseMotionListener(l); // 处理鼠标滑动操作
timer = new Timer(); // 主流程控制
timer.schedule(new TimerTask() {
public void run() {
if (state == RUNNING) {
enterAction(); // 飞行物入场
stepAction(); // 走一步
shootAction(); // 射击
bangAction(); // 子弹打飞行物
outOfBoundsAction(); // 删除越界飞行物及子弹
checkGameOverAction(); // 检查游戏结束
emberAction();
repaint(); // 重绘,调用paint()方法
}, intervel, intervel);
private void emberAction() {
Ember[] live = new Ember[embers.length];
int index = 0;
for (int i = 0; i & embers. i++) {
Ember ember = embers[i];
if(! ember.burnDown()){
live[index++]=
embers = Arrays.copyOf(live, index);
int flyEnteredIndex = 0; // 飞行物入场计数
/** 飞行物入场 */
public void enterAction() {
flyEnteredIndex++;
if (flyEnteredIndex % 40 == 0) { // 300毫秒--10*30
FlyingObject obj = nextOne(); // 随机生成一个飞行物
flyings = Arrays.copyOf(flyings, flyings.length + 1);
flyings[flyings.length - 1] =
public void stepAction() {
/** 飞行物走一步 */
for (int i = 0; i & flyings. i++) { // 飞行物走一步
FlyingObject f = flyings[i];
/** 子弹走一步 */
for (int i = 0; i & bullets. i++) {
Bullet b = bullets[i];
hero.step();
for (int i = 0; i & bullets2. i++) {
EnemyBullet c = bullets2[i];
int shootIndex = 0; // 射击计数
/** 射击 */
public void shootAction() {
shootIndex++;
if (shootIndex % 30 == 0) { // 100毫秒发一颗
Bullet[] bs = hero.shoot(); // 英雄打出子弹
bullets = Arrays.copyOf(bullets, bullets.length + bs.length); // 扩容
System.arraycopy(bs, 0, bullets, bullets.length - bs.length,bs.length); // 追加数组
if (shootIndex % 100 == 0) {// 大Boss发射子弹
for (int i = 0; i & flyings. i++) {
if (flyings[i] instanceof BigPlane) {// 大Boss发射子弹
BigPlane boss = (BigPlane) flyings[i];
EnemyBullet[] b = boss.shoot();
bullets2 = Arrays.copyOf(bullets2, bullets2.length + b.length);
System.arraycopy(b, 0, bullets2, bullets2.length - b.length, b.length);
if (shootIndex % 30 == 0) { // 100毫秒发一颗
EnemyBullet[] bs2 =big.shoot();
bullets = Arrays.copyOf(bullets, bullets.length + bs2.length); // 扩容
System.arraycopy(bs2, 0, bullets, bullets.length - bs2.length,
bs2.length); // 追加数组
/** 子弹与飞行物碰撞检测 */
public void bangAction() {
for (int i = 0; i & bullets. i++) { // 遍历所有子弹
Bullet b = bullets[i];
/** 删除越界飞行物及子弹 */
public void outOfBoundsAction() {
int index = 0;
FlyingObject[] flyingLives = new FlyingObject[flyings.length]; // 活着的飞行物
for (int i = 0; i & flyings. i++) {
FlyingObject f = flyings[i];
if (!f.outOfBounds()) {
flyingLives[index++] = // 不越界的留着
flyings = Arrays.copyOf(flyingLives, index); // 将不越界的飞行物都留着
index = 0; // 重置为0
Bullet[] bulletLives = new Bullet[bullets.length];
for (int i = 0; i & bullets. i++) {
Bullet b = bullets[i];
if (!b.outOfBounds()) {
bulletLives[index++] =
bullets = Arrays.copyOf(bulletLives, index); // 将不越界的子弹留着
/** 检查游戏结束 */
public void checkGameOverAction() {
if (isGameOver()) {
DAO.save(score);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
state = GAME_OVER; // 改变状态
/** 检查游戏是否结束 */
public boolean isGameOver() {
int index = -1;
for (int i = 0; i & flyings. i++) {
FlyingObject obj = flyings[i];
if (hero.hit(obj)) { // 检查英雄机与飞行物是否碰撞
hero.subtractLife();
hero.setDoubleFire(0);
Ember ember = new Ember(hero);
embers = Arrays.copyOf(embers, embers.length+1);
embers[embers.length-1]=
if(index!=-1){
FlyingObject t = flyings[index];
flyings[index] = flyings[flyings.length-1];
flyings[flyings.length-1] =
flyings = Arrays.copyOf(flyings, flyings.length-1);
Ember ember = new Ember(t);
embers = Arrays.copyOf(embers, embers.length+1);
embers[embers.length-1]=
for (int i = 0; i & bullets2. i++) {
EnemyBullet bb = bullets2[i]; // 获取每一个敌人对象
if (hero.hit2(bb)) { // 返回true,英雄机与敌人相撞了
hero.subtractLife(); // 英雄机减命
hero.setDoubleFire(0); // 英雄机火力值为0,单倍火力
// 碰撞后敌人的后果是消失
EnemyBullet bb1 = bullets2[i];
bullets2[i] = bullets2[bullets2.length - 1];
bullets2[bullets2.length - 1] = bb1;
bullets2 = Arrays.copyOf(bullets2, bullets2.length - 1);
return hero.getLife() &= 0;
/** 子弹和飞行物之间的碰撞检查 */
public void bang(Bullet bullet) {
int index = -1; // 击中的飞行物索引
for (int i = 0; i & flyings. i++) {
FlyingObject obj = flyings[i];
if (obj.shootBy(bullet)) { // 判断是否击中
index = // 记录被击中的飞行物的索引
if (index != -1) { // 有击中的飞行物
FlyingObject one = flyings[index]; // 记录被击中的飞行物
FlyingObject temp = flyings[index]; // 被击中的飞行物与最后一个飞行物交换
flyings[index] = flyings[flyings.length - 1];
flyings[flyings.length - 1] =
flyings = Arrays.copyOf(flyings, flyings.length - 1); // 删除最后一个飞行物(即被击中的)
// 检查one的类型 如果是敌人, 就算分
if (one instanceof Enemy) { // 检查类型,是敌人,则加分
Enemy e = (Enemy) // 强制类型转换
score += e.getScore(); // 加分
if (one instanceof Award) { // 若为奖励,设置奖励
Award a = (Award)
int type = a.getType(); // 获取奖励类型
switch (type) {
case Award.DOUBLE_FIRE:
hero.addDoubleFire(); // 设置双倍火力
case Award.LIFE:
hero.addLife(); // 设置加命
//飞行物变成灰烬
Ember ember = new Ember(one);
embers = Arrays.copyOf(embers, embers.length+1);
embers[embers.length-1]=
* 随机生成飞行物
* @return 飞行物对象
public static FlyingObject nextOne() {
Random random = new Random();
int type = random.nextInt(20); // [0,4)
if (type==0) {
return new Bee();
}else if(type&=2){
return new BigPlane();
return new Airplane();
下面实现数据库的连接,首先编写将分数写入数据库的方法,在src重新建一个包,包里写写入分数的方法。
&code class="language-java"&package DAO;
import java.sql.C
import java.sql.PreparedS
import java.sql.SQLE
import util.DBU
public class DAO {
* 增加分数的方法
public static void save(int score) throws Exception{
PreparedStatement ps=
Connection conn =
conn = DBUtil.getConnection();
String sql ="INSERT INTO mydb2(score) values(?)";
ps = conn.prepareStatement(sql);
ps.setInt(1,score);
ps.executeUpdate();
}catch(SQLException e){
e.printStackTrace();
DBUtil.close(conn);
然后连接数据库
import java.sql.C
import java.sql.DriverM
import java.sql.SQLE
public class DBUtil {
public static void main(String[]args) throws Exception{
Connection conn = DBUtil.getConnection();
System.out.println(conn);
DBUtil.close(conn);
public static void close(Connection conn){
if(conn != null){
conn.close();
}catch(SQLException e){
e.printStackTrace();
public static Connection getConnection() throws Exception{
//System.out.println("112");
Connection conn =
//1.注册驱动(加载驱动)
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
conn = DriverManager.getConnection("jdbc:sqlserver://localhost:1433;DatabaseName=数据库名字","sa", "********");
//System.out.println("123");
Class.forName("com.microsoft.sqlserver.jdbc.Driver");
System.out.println("111");
//2.建立连接
conn = DriverManager.getConnection("jdbc:sqlserver://localhost:1443/mydb2","sa","the1012secret");
System.out.println("111");
}catch(ClassNotFoundException e){
//System.out.println("注册驱动");
}catch(SQLException e){
e.printStackTrace();
您可能感兴趣的文章:
大家感兴趣的内容
12345678910
最近更新的内容
常用在线小工具}

我要回帖

更多关于 飞机大战中第一架动物形象的战机 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信