- 5.81 MB
- 76页
- 1、本文档共5页,可阅读全部内容。
- 2、本文档内容版权归属内容提供方,所产生的收益全部归内容提供方所有。如果您对本文有版权争议,可选择认领,认领后既往收益都归您。
- 3、本文档由用户上传,本站不保证质量和数量令人满意,可能有诸多瑕疵,付费之前,请仔细先通过免费阅读内容等途径辨别内容交易风险。如存在严重挂羊头卖狗肉之情形,可联系本站下载客服投诉处理。
- 文档侵权举报电话:19940600175。
'07组项目报告项目名称护蛋小分队完成时间2017/07/13总代码量2400行项目组长孟祥宇小组成员成员分工自评成绩(A/B/C)孟祥宇项目报告、游戏框架、炫酷音效A胡文卿游戏特效、靓丽图片、游戏逻辑A黄耕酉游戏功能、子弹技能、强力优化A需求分析1.概论本游戏的实质是经典坦克大战。我们又结合了“愤怒的小鸟”主题元素,优化了游戏界面、游戏背景音乐和特效,同时增加了我方坦克的技能。2.功能需求分析游戏拥有单人游戏和双人游戏两种战斗模式,并附加有任务选择器,可以选择任意关卡。每关需要在复杂的地形上摧毁18名敌人才能通过,如果玩家的坦克被摧毁多次或己方基地被毁即算任务失败。游戏中我方坦克拥有七种不同的炮弹:①胖红:体型小,速度中等,伤害低,数量无限。②飞镖黄:体型较小,速度快,伤害高。③蓝弟弟:体型极小,速度中等,伤害低,击中目标后会像向垂直方向发射两个分身。④炸弹黑:体型较大,速度慢,伤害低,击中目标后会在周围形成大范围爆炸。⑤大红:体型极大,速度中等,摧毁正前方的一切。⑥白公主:体型较大,速度中等,伤害低,会在发炮原地留下一颗“炸蛋”,同自身向前方飞行。三秒后,“炸蛋”会在周围造成小范围爆炸。⑦长嘴绿:体型中等,可以回旋,并且摧毁回旋路径上的一切。⑧追踪弹:自动追踪一头猪。敌人拥有五种类型:①普通猪:防御能力弱,伤害中等。②队长猪:防御力中等,伤害中等。④巨猪:体型极大,防御力高,子弹巨大,伤害高。③国王猪:防御力极高,伤害极大。④小猪:速度非常非常快
3.背景需求分析护蛋小分队地形包括玻璃、石块、草丛、树木5种。游戏的结束、开始、暂停界面都有不同的动态背景图片和背景音乐。发射炮弹、摧毁地形、敌军死亡会有不同的音效。4.游戏难度需求分析游戏共有20关,游戏难度逐渐增加。从第十关开始,引入人工智能算法,让敌军可以判断我方坦克位置,并会智能地向我方移动和发射,而且会巧妙地躲避子弹。5.游戏流程图概要设计1.结构图坦克类:实现坦克的移动、射击、碰撞检测等功能子弹类:实现子弹的移动、攻击、销毁等功能墙类:实现不用的地图快数据库:包括phonon、QImage、QIcon、QRect
1.数据结构属性归属属性类型属性名称属性意义初始值TankWallMissileintx,y横纵坐标0intw,h长度宽度0intlive生命值100intkind区别种类0TankMissileDIR(枚举)dir方向Uboolgood区别敌我方true无int型三维数组map储存地图三维数组3.类图
4.每一个类的主要内容:
功能测试1.酷酷的界面:
2.美腻的选关系统3.美轮美奂的游戏地图
4.四种炫酷的技能5调皮的绿皮猪
实验小结我们三人小组的这次合作非常成功,原本只是想做一个简单的坦克大战,能移动能开炮就行了,但是由于我们三个对游戏开发热情以及互相帮助,不到一个周就把游戏的基本功能全都实现了,之后的两个周就是开发各种新功能以及尽可能的优化游戏效果,最终版的效果非常完美。但开发的过程也遇到了很多难题,比如我们在写双人模式时,“↑↓←→”四个按键失效,这个问题困扰了我们好一阵子,我们首先通过改用其它按键的方发锁定问题时“↑↓←→”没有被获取,后来经过查阅书籍、资料以及一个晚上的讨论,才解决这个由键盘焦点引发的问题。再有最大的问题就是菜单,一开始只准备写“开始、重新开始、退出”三个按钮,所以也不用注重什么逻辑,但后来增加“暂停/继续、下一关、选关、返回”等按钮时,就因为一开始的了逻辑漏洞出了很大的问题,浪费了好多时间。下次开始一个项目前,我得好好规划一下,一开始就为整个程序做好准备,把整个框架梳理出来,这样在以后加功能和优化代码时能更方便。最后就是分工,刚开始我们计划每个人负责一部分,分开写,但是经过两天的实践后,发现这种方法行不通。毕竟我们对QT基本上是一无所知的,所以立马改变策略——一起学,一起做。后来的开发实战证明了这一转变是正确的,我们三个人互相帮扶,开发的很快,也都学到了不少东西,最终的的游戏效果更是一流的棒。体会:孟祥宇:这次大作业,我不仅收获了人生中第一个拿得出手的程序,更是收获了和我并肩站的朋友两枚,值了值了。胡文卿:果然是人在忙碌时,时间就会过得飞快。这两周的生活,真是痛并快乐着。我们每天上课做项目,下午各做各的,晚上又一起做项目,回寝室后又开始自己解决各种难题。每天都在不停的奋斗。这期间,我经历了意见不同的争吵,也经历了项目取得进展的激动与快乐。我感触最深的就是团队成员意见不一时,争吵是没有一点用的。要心平气和的坐下来,慢慢地说服对方或者被对方说服。做项目的日子里,我不仅学会了和队友的相处,还收获了很多的经验和知识。做项目的时候,要明确分工,知道自己应该做什么。另外,需求分析真的很重要。最开始的时候就应该想好要做什么东西,做出什么效果。不然的话,最后总是事倍功半。做项目的日子结束了,但是,我的收获将永存于心。以后我将更加从容地对待各种难题。很高兴有这么个机会,让自己增长经验。黄耕酉:小学期的生活就要结束了。我们挥洒的汗水终于浇灌出美丽的花朵。这期间的生活真的是很累,但也很充实。我们经历了很多,一起解决难题;一起面对难题抓耳挠腮;一起享受项目取得进展的激动与快乐。这短短的;两周,我感觉自己进步了很多。
代码:Mytank.proQT+=phononSOURCES+=main.cppMainWindow.cpptank.cppwall.cppmissile.cppexplode.cppHEADERS+=MainWindow.htank.hpublic.hwall.hmissile.hexplode.hRESOURCES+=tank.qrcExplode.h#ifndefEXPLODE_H#defineEXPLODE_H#include#includeclassQPainter;classMainWindow;classExplode{public:Explode(intx,inty,MainWindow*tc,inttype,boolgood);voiddrawExplode(QPainter&p);intx,y;//坐标inttype;//种类boollive;//生命boolgood;//敌我方判断intdis[10];inti;MainWindow*tc;staticQListexplodeImgs0;staticQListexplodeImgs1;staticQListexplodeImgs2;
staticQListexplodeImgs3;};#endif//EXPLODE_HMainWindow.h#ifndefMainWindow_H#defineMainWindow_H#include#include"tank.h"#include"missile.h"#include#include"wall.h"#include"explode.h"#includeclassExplode;classWall;classQPushButton;classMainWindow:publicQMainWindow{Q_OBJECTpublic:MainWindow(QWidget*parent=0);voidinit();//图片存入容器voidpaintEvent(QPaintEvent*);voidtimerEvent(QTimerEvent*e);voidkeyPressEvent(QKeyEvent*e);voidkeyReleaseEvent(QKeyEvent*e);voidmousePressEvent(QMouseEvent*e);voidAllObject();voidMusic();voidButtons();~MainWindow();staticconstintGAME_WIDTH=1000;staticconstintGAME_HEIGHT=680;boolstart;boolgameover,victory;boolchoosemap;boolpause;Tank*mytank;Tank*mytank1;QListetanks;QListexplodes;QListmyWall;QListbutton;
staticQListlogoImgs;staticQListchooseImgs;staticQListButtonImgs;intstep;intnumber;intWhitchMap;//哪一关intlastWhitchMap;privateslots:voidpressStartone();voidpressStarttwo();voidpressRestart();voidchooseMap();voidbackMenu();voidback();voidstartgame();public:Phonon::MediaObject*backgoundMusic;Phonon::MediaObject*backgoundMusic1;Phonon::MediaObject*boom_woodMusic;Phonon::MediaObject*missile0_shootMusic;Phonon::MediaObject*missile1_shootMusic;Phonon::MediaObject*missile2_shootMusic;Phonon::MediaObject*missile3_shootMusic;Phonon::MediaObject*missile4_shootMusic;Phonon::MediaObject*pig_deadMusic;Phonon::MediaObject*player_injuryMusic;};#endif//MainWindow_HMissile.h#ifndefMISSILE_H#defineMISSILE_H#include"public.h"#include#include#includeclassQPainter;classMainWindow;classTank;classWall;classMissile{public:
Missile(intx,inty,intw,inth,Dirdir,MainWindow*tc,boolgood,inttype);voiddrawMissile(QPainter&p,QListts);voidmoveMissile(QListts);boolhitTank(Tank*t);voidhitTanks(QListts);boolhitWall(Wall*w);voidhitWalls(QListws);boolhitMissile(Missile*m);voidhitMissiles(QListms);inlineQRectgetRect(){returnQRect(x,y,w,h);}//获得自身相交的矩形intx,y,w,h;//坐标、大小Dirdir;//方向boollive;MainWindow*tc;booltlive;boollivewall;boolgood;//敌我方判断inttype;//子弹种类staticQListmissileImgs;};#endif//MISSILE_HPublic.h#ifndefPUBLIC_H#definePUBLIC_HenumDir{U,D,L,R,STOP};//方向#endif//PUBLIC_HTank.h#ifndefTANK_H#defineTANK_H#include"public.h"#include"missile.h"#include#include#includeclassQPainter;classMainWindow;classWall;classTank{public:
Tank(intx,inty,intw,inth,MainWindow*tc,boolgood,intliveValue,intkind);voiddrawTank(QPainter&p);voidkeyRelease(intkey);voidkeyPress(intkey);voidmoveTank();voidfire(inttype);boolTankHitWall(Wall*w);//检测坦克和墙壁是否碰撞voidTankHitWalls(QListws);inlineQRectgetRect(){returnQRect(x,y,w,h);}//获得自身相交的矩形intx,y,w,h;boolBU,BD,BL,BR;Dirdir;DirptDir;//子弹方向MainWindow*tc;QListmissile;boolgood;boollive;//判断生存状态intstep;intxtemp,ytemp;//用于记录坦克上次的位置intliveValue;//生命值intcount;//敌方坦克出生三秒静止无敌intkind;staticQListmytankImgs;staticQListenemytankImgs;};#endif//TANK_HWall.h#ifndefWALL_H#defineWALL_H#include#includeclassQPainter;classMainWindow;classWall{public:Wall(intx,inty,intw,inth,intwhatwall,MainWindow*tc,intliveValue);voiddrawWall(QPainter&p);inlineQRectgetRect(){returnQRect(x,y,w,h);}//获得自身相交的矩形intx,y,w,h;intwhatwall;
boollive;MainWindow*tc;intliveValue;staticQListwallImgs;};#endif//WALL_HExplode.cpp#include"explode.h"#include#include"MainWindow.h"QListExplode::explodeImgs0;//tankQListExplode::explodeImgs1;//redQListExplode::explodeImgs2;//yellowQListExplode::explodeImgs3;//blueExplode::Explode(intx,inty,MainWindow*tc,inttype,boolgood){this->x=x;this->good=good;this->y=y;this->type=type;live=true;i=0;intis[10]={10,12,15,20,23,25,27,30,32,35};for(inti=0;i<10;i++){dis[i]=is[i];}this->tc=tc;}voidExplode::drawExplode(QPainter&p){if(!live){tc->explodes.removeOne(this);return;}if(type==0)p.drawImage(x,y,explodeImgs0[i]);elseif(type==1&&good)p.drawImage(x,y,explodeImgs1[i]);elseif(type==2)p.drawImage(x,y,explodeImgs2[i]);elseif(type==3||type==5)
p.drawImage(x,y,explodeImgs3[i]);i++;if(i==11){i=0;live=false;}}Main.cpp#include#include#include"MainWindow.h"intmain(intargc,char*argv[]){QTextCodec::setCodecForTr(QTextCodec::codecForLocale());QApplicationa(argc,argv);MainWindoww;w.show();returna.exec();}MainWindow.cpp#include"MainWindow.h"#include#include#include"tank.h"#include"public.h"#include"missile.h"#include"explode.h"#include"wall.h"QListMainWindow::logoImgs;QListMainWindow::chooseImgs;QListMainWindow::ButtonImgs;QListTank::mytankImgs;QListTank::enemytankImgs;inta=0;intb=1;intid1,id2;QListminmissile;intmap[10][34][34]={{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0},{0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0},{0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0},{0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0},{0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0},{0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0},{0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0},{0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0},{0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,4,4,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0},{0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,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1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}},};voidMainWindow::init(){Tank::mytankImgs.push_back(QImage(":/images/dapao2U.png"));//上Tank::mytankImgs.push_back(QImage(":/images/dapao2D.png"));//下Tank::mytankImgs.push_back(QImage(":/images/dapao2L.png"));//左Tank::mytankImgs.push_back(QImage(":/images/dapao2R.png"));//右
Tank::mytankImgs.push_back(QImage(":/images/dapaoU.png"));//上Tank::mytankImgs.push_back(QImage(":/images/dapaoD.png"));//下Tank::mytankImgs.push_back(QImage(":/images/dapaoL.png"));//左Tank::mytankImgs.push_back(QImage(":/images/dapaoR.png"));//右Tank::enemytankImgs.push_back(QImage(":/images/greenpigP1.png"));//国王1Tank::enemytankImgs.push_back(QImage(":/images/greenpigP2.png"));//国王2Tank::enemytankImgs.push_back(QImage(":/images/greenpigP3.png"));//国王3Tank::enemytankImgs.push_back(QImage(":/images/greenpigP4.png"));//国王4Tank::enemytankImgs.push_back(QImage(":/images/greenpig1.png"));//平民1Tank::enemytankImgs.push_back(QImage(":/images/greenpig2.png"));//平民2Tank::enemytankImgs.push_back(QImage(":/images/greenpigI1.png"));//铁卫1Tank::enemytankImgs.push_back(QImage(":/images/greenpigI2.png"));//铁卫2Tank::enemytankImgs.push_back(QImage(":/images/greenpigI3.png"));//铁卫3Tank::enemytankImgs.push_back(QImage(":/images/appear1.png"));//铁卫2Tank::enemytankImgs.push_back(QImage(":/images/appear2.png"));//铁卫3Missile::missileImgs.push_back(QImage(":/images/redbirdU.png"));Missile::missileImgs.push_back(QImage(":/images/redbirdD.png"));Missile::missileImgs.push_back(QImage(":/images/redbirdL.png"));Missile::missileImgs.push_back(QImage(":/images/redbirdR.png"));Missile::missileImgs.push_back(QImage(":/images/yellowbirdU.png"));Missile::missileImgs.push_back(QImage(":/images/yellowbirdD.png"));
Missile::missileImgs.push_back(QImage(":/images/yellowbirdL.png"));Missile::missileImgs.push_back(QImage(":/images/yellowbirdR.png"));Missile::missileImgs.push_back(QImage(":/images/bluebirdU.png"));Missile::missileImgs.push_back(QImage(":/images/bluebirdD.png"));Missile::missileImgs.push_back(QImage(":/images/bluebirdL.png"));Missile::missileImgs.push_back(QImage(":/images/bluebirdR.png"));Missile::missileImgs.push_back(QImage(":/images/blackbirdU.png"));Missile::missileImgs.push_back(QImage(":/images/blackbirdD.png"));Missile::missileImgs.push_back(QImage(":/images/blackbirdL.png"));Missile::missileImgs.push_back(QImage(":/images/blackbirdR.png"));Missile::missileImgs.push_back(QImage(":/images/pigmissile.png"));//将来换成绿鸟Missile::missileImgs.push_back(QImage(":/images/redbirdU.png"));Missile::missileImgs.push_back(QImage(":/images/bluebirdD.png"));Missile::missileImgs.push_back(QImage(":/images/yellowbirdL.png"));Missile::missileImgs.push_back(QImage(":/images/blackbirdR.png"));Explode::explodeImgs0.push_back(QImage(":/images/pigdead1.png"));Explode::explodeImgs0.push_back(QImage(":/images/pigdead1.png"));Explode::explodeImgs0.push_back(QImage(":/images/pigdead1.png"));Explode::explodeImgs0.push_back(QImage(":/images/pigdead1.png"));Explode::explodeImgs0.push_back(QImage(":/images/pigdead2.png"));Explode::explodeImgs0.push_back(QImage(":/images/pigdead2.png"));Explode::explodeImgs0.push_back(QImage(":/images/pigdead2.png"));Explode::explodeImgs0.push_back(QImage(":/images/pigdead2.png"));Explode::explodeImgs0.push_back(QImage(":/images/pigdead3.png"));Explode::explodeImgs0.push_back(QImage(":/images/pigdead3.png"));Explode::explodeImgs0.push_back(QImage(":/images/pigdead3.png"));Explode::explodeImgs0.push_back(QImage(":/images/pigdead3.png"));Explode::explodeImgs1.push_back(QImage(":/images/redpeng1.png"));Explode::explodeImgs1.push_back(QImage(":/images/redpeng1.png"));Explode::explodeImgs1.push_back(QImage(":/images/redpeng1.png"));Explode::explodeImgs1.push_back(QImage(":/images/redpeng1.png"));Explode::explodeImgs1.push_back(QImage(":/images/redpeng2.png"));Explode::explodeImgs1.push_back(QImage(":/images/redpeng2.png"));Explode::explodeImgs1.push_back(QImage(":/images/redpeng2.png"));
Explode::explodeImgs1.push_back(QImage(":/images/redpeng2.png"));Explode::explodeImgs1.push_back(QImage(":/images/redpeng3.png"));Explode::explodeImgs1.push_back(QImage(":/images/redpeng3.png"));Explode::explodeImgs1.push_back(QImage(":/images/redpeng3.png"));Explode::explodeImgs1.push_back(QImage(":/images/redpeng3.png"));Explode::explodeImgs2.push_back(QImage(":/images/yellowpeng1.png"));Explode::explodeImgs2.push_back(QImage(":/images/yellowpeng1.png"));Explode::explodeImgs2.push_back(QImage(":/images/yellowpeng1.png"));Explode::explodeImgs2.push_back(QImage(":/images/yellowpeng1.png"));Explode::explodeImgs2.push_back(QImage(":/images/yellowpeng2.png"));Explode::explodeImgs2.push_back(QImage(":/images/yellowpeng2.png"));Explode::explodeImgs2.push_back(QImage(":/images/yellowpeng2.png"));Explode::explodeImgs2.push_back(QImage(":/images/yellowpeng2.png"));Explode::explodeImgs2.push_back(QImage(":/images/yellowpeng3.png"));Explode::explodeImgs2.push_back(QImage(":/images/yellowpeng3.png"));Explode::explodeImgs2.push_back(QImage(":/images/yellowpeng3.png"));Explode::explodeImgs2.push_back(QImage(":/images/yellowpeng3.png"));Explode::explodeImgs3.push_back(QImage(":/images/bluepeng1.png"));Explode::explodeImgs3.push_back(QImage(":/images/bluepeng1.png"));Explode::explodeImgs3.push_back(QImage(":/images/bluepeng1.png"));Explode::explodeImgs3.push_back(QImage(":/images/bluepeng1.png"));Explode::explodeImgs3.push_back(QImage(":/images/bluepeng2.png"));Explode::explodeImgs3.push_back(QImage(":/images/bluepeng2.png"));Explode::explodeImgs3.push_back(QImage(":/images/bluepeng2.png"));
Explode::explodeImgs3.push_back(QImage(":/images/bluepeng2.png"));Explode::explodeImgs3.push_back(QImage(":/images/bluepeng3.png"));Explode::explodeImgs3.push_back(QImage(":/images/bluepeng3.png"));Explode::explodeImgs3.push_back(QImage(":/images/bluepeng3.png"));Explode::explodeImgs3.push_back(QImage(":/images/bluepeng3.png"));Wall::wallImgs.push_back(QImage(":/images/wall0"));//土墙Wall::wallImgs.push_back(QImage(":/images/wall1"));//草丛Wall::wallImgs.push_back(QImage(":/images/wall2"));//水流Wall::wallImgs.push_back(QImage(":/images/wall3"));//水泥MainWindow::chooseImgs.push_back(QImage(":/images/1_1.png"));MainWindow::chooseImgs.push_back(QImage(":/images/2_1.png"));MainWindow::chooseImgs.push_back(QImage(":/images/3_1.png"));MainWindow::chooseImgs.push_back(QImage(":/images/4_1.png"));MainWindow::chooseImgs.push_back(QImage(":/images/5_1.png"));MainWindow::chooseImgs.push_back(QImage(":/images/6_1.png"));MainWindow::chooseImgs.push_back(QImage(":/images/7_1.png"));MainWindow::chooseImgs.push_back(QImage(":/images/8_1.png"));MainWindow::chooseImgs.push_back(QImage(":/images/9_1.png"));MainWindow::chooseImgs.push_back(QImage(":/images/10_1.png"));MainWindow::chooseImgs.push_back(QImage(":/images/1_2.png"));MainWindow::chooseImgs.push_back(QImage(":/images/2_2.png"));MainWindow::chooseImgs.push_back(QImage(":/images/3_2.png"));MainWindow::chooseImgs.push_back(QImage(":/images/4_2.png"));MainWindow::chooseImgs.push_back(QImage(":/images/5_2.png"));MainWindow::chooseImgs.push_back(QImage(":/images/6_2.png"));MainWindow::chooseImgs.push_back(QImage(":/images/7_2.png"));MainWindow::chooseImgs.push_back(QImage(":/images/8_2.png"));MainWindow::chooseImgs.push_back(QImage(":/images/9_2.png"));MainWindow::chooseImgs.push_back(QImage(":/images/10_2.png"));MainWindow::logoImgs.push_back(QImage(""));MainWindow::logoImgs.push_back(QImage(":/images/gameover.png"));//失败标语MainWindow::logoImgs.push_back(QImage(":/images/victory.png"));//胜利标语MainWindow::logoImgs.push_back(QImage(":/images/YouCeShuoMingBG.png"));//右侧说明
MainWindow::logoImgs.push_back(QImage(":/images/GameBG.png"));//主背景MainWindow::logoImgs.push_back(QImage(":/images/LaoJia.png"));//老家MainWindow::logoImgs.push_back(QImage(":/images/gameoverBG.png"));//胜利背景MainWindow::logoImgs.push_back(QImage(":/images/victoryBG.png"));//失败背景MainWindow::ButtonImgs.push_back(QIcon(":/images/Button_Again.png"));//重来MainWindow::ButtonImgs.push_back(QIcon(":/images/Button_OnePlayer.png"));//单人MainWindow::ButtonImgs.push_back(QIcon(":/images/Button_TwoPlayer.png"));//双人MainWindow::ButtonImgs.push_back(QIcon(":/images/Button_Choose.png"));//选关MainWindow::ButtonImgs.push_back(QIcon(":/images/Button_Exit.png"));//退出MainWindow::ButtonImgs.push_back(QIcon(":/images/Button_Next.png"));//下一关MainWindow::ButtonImgs.push_back(QIcon(":/images/Button_Continue.png"));//继续MainWindow::ButtonImgs.push_back(QIcon(":/images/Button_Return.png"));//继续}MainWindow::MainWindow(QWidget*parent):QMainWindow(parent){//初始化step=0;WhitchMap=0;number=0;lastWhitchMap=0;pause=false;start=false;
gameover=false;victory=false;choosemap=false;//设置窗口setWindowTitle(tr("护鸟小分队"));setStyleSheet("image:url(:/images/BG.png)");//设置背景图片setFixedSize(GAME_WIDTH,GAME_HEIGHT);//设置窗口的大小,并固定窗口大小move(200,20);//把窗口移动到屏幕中央//调用四大函数init();AllObject();Buttons();Music();id1=startTimer(30);//开启定时器}MainWindow::~MainWindow(){}voidMainWindow::paintEvent(QPaintEvent*){backgoundMusic->play();QPainterp(this);if(start){victory=false;gameover=false;p.drawImage(0,0,logoImgs[4]);p.drawImage(GAME_HEIGHT,0,logoImgs[3]);p.drawImage(320,640,logoImgs[5]);//画老家for(inti=0;ihide();}mytank->drawTank(p);//画主战坦克mytank->TankHitWalls(myWall);//主战坦克和所有墙壁进行碰撞检测p.setPen(QColor(1,50,100));p.drawText(680,10,tr("玩家一生命值:")+QString::number(mytank->liveValue));if(number==2)p.drawText(680,30,tr("玩家二生命值:")+QString::number(mytank1->liveValue));p.drawText(680,50,tr("敌坦数量:")+QString::number(etanks.size()));
for(inti=0;imissile.size();i++)//画我方坦克子弹{mytank->missile[i]->hitTanks(etanks);mytank->missile[i]->hitWalls(myWall);for(intj=0;j<3&&jmissile[i]->hitMissiles(etanks[j]->missile);mytank->missile[i]->drawMissile(p,etanks);if(mytank->missile[i]->type==2&&!(mytank->missile[i]->live)){if(mytank->missile[i]->dir==U){Missile*m1=newMissile(mytank->missile[i]->x-5,mytank->missile[i]->y+5,10,10,L,this,true,5);minmissile.push_back(m1);Missile*m2=newMissile(mytank->missile[i]->x+5,mytank->missile[i]->y+5,10,10,R,this,true,5);minmissile.push_back(m2);}elseif(mytank->missile[i]->dir==D){Missile*m1=newMissile(mytank->missile[i]->x-5,mytank->missile[i]->y-5,10,10,L,this,true,5);minmissile.push_back(m1);Missile*m2=newMissile(mytank->missile[i]->x+5,mytank->missile[i]->y-5,10,10,R,this,true,5);minmissile.push_back(m2);}elseif(mytank->missile[i]->dir==L){Missile*m1=newMissile(mytank->missile[i]->x+5,mytank->missile[i]->y-5,10,10,U,this,true,5);minmissile.push_back(m1);Missile*m2=newMissile(mytank->missile[i]->x+5,mytank->missile[i]->y+5,10,10,D,this,true,5);minmissile.push_back(m2);}elseif(mytank->missile[i]->dir==R)
{Missile*m1=newMissile(mytank->missile[i]->x-5,mytank->missile[i]->y-5,10,10,U,this,true,5);minmissile.push_back(m1);Missile*m2=newMissile(mytank->missile[i]->x-5,mytank->missile[i]->y+5,10,10,D,this,true,5);minmissile.push_back(m2);}}if(mytank->missile[i]->type==3&&!(mytank->missile[i]->live)){for(intj=0;jmissile[i]->x-20,mytank->missile[i]->y-20,40,40).intersects(myWall[j]->getRect())){myWall[j]->live=0;}}for(intk=0;kmissile[i]->x-20,mytank->missile[i]->y-20,40,40).intersects(etanks[k]->getRect())){etanks[k]->live=0;}for(intl=0;lmissile.size();l++){if(QRect(mytank->missile[i]->x-20,mytank->missile[i]->y-20,40,40).intersects(etanks[k]->missile[l]->getRect())){etanks[k]->missile[l]->live=0;}}}}}for(inti=0;ihitTanks(etanks);minmissile[i]->hitWalls(myWall);for(intj=0;j<3&&jhitMissiles(etanks[j]->missile);minmissile[i]->drawMissile(p,etanks);}for(inti=0;ilive==0)minmissile.removeOne(minmissile[i]);}for(inti=0;imissile.size();i++)//删除我方死子弹{if(mytank->missile[i]->live==0)mytank->missile.removeOne(mytank->missile[i]);}if(number==2){mytank1->drawTank(p);//画主战坦克mytank1->TankHitWalls(myWall);//主战坦克和所有墙壁进行碰撞检测for(inti=0;imissile.size();i++)//画我方坦克子弹{mytank1->missile[i]->hitTanks(etanks);mytank1->missile[i]->hitWalls(myWall);for(intj=0;j<3&&jmissile[i]->hitMissiles(etanks[j]->missile);mytank1->missile[i]->drawMissile(p,etanks);if(mytank1->missile[i]->type==2&&!(mytank1->missile[i]->live)){if(mytank1->missile[i]->dir==U){Missile*m1=newMissile(mytank1->missile[i]->x-5,mytank1->missile[i]->y+5,10,10,L,this,true,4);minmissile.push_back(m1);Missile*m2=newMissile(mytank1->missile[i]->x+5,mytank1->missile[i]->y+5,10,10,R,this,true,4);minmissile.push_back(m2);}elseif(mytank1->missile[i]->dir==D)
{Missile*m1=newMissile(mytank1->missile[i]->x-5,mytank1->missile[i]->y-5,10,10,L,this,true,4);minmissile.push_back(m1);Missile*m2=newMissile(mytank1->missile[i]->x+5,mytank1->missile[i]->y-5,10,10,R,this,true,4);minmissile.push_back(m2);}elseif(mytank1->missile[i]->dir==L){Missile*m1=newMissile(mytank1->missile[i]->x+5,mytank1->missile[i]->y-5,10,10,U,this,true,4);minmissile.push_back(m1);Missile*m2=newMissile(mytank1->missile[i]->x+5,mytank1->missile[i]->y+5,10,10,D,this,true,4);minmissile.push_back(m2);}elseif(mytank1->missile[i]->dir==R){Missile*m1=newMissile(mytank1->missile[i]->x-5,mytank1->missile[i]->y-5,10,10,U,this,true,4);minmissile.push_back(m1);Missile*m2=newMissile(mytank1->missile[i]->x-5,mytank1->missile[i]->y+5,10,10,D,this,true,4);minmissile.push_back(m2);}}if(mytank1->missile[i]->type==3&&!(mytank1->missile[i]->live)){for(intj=0;jmissile[i]->x-20,mytank1->missile[i]->y-20,40,40).intersects(myWall[j]->getRect())){myWall[j]->live=0;}
}for(intk=0;kmissile[i]->x-20,mytank1->missile[i]->y-20,40,40).intersects(etanks[k]->getRect())){etanks[k]->live=0;}for(intl=0;lmissile.size();l++){if(QRect(mytank1->missile[i]->x-20,mytank1->missile[i]->y-20,40,40).intersects(etanks[k]->missile[l]->getRect())){etanks[k]->missile[l]->live=0;}}}}}for(inti=0;imissile.size();i++)//删除我方死子弹{if(mytank1->missile[i]->live==0)mytank1->missile.removeOne(mytank1->missile[i]);}for(inti=0;ihitTanks(etanks);minmissile[i]->hitWalls(myWall);for(intj=0;j<3&&jhitMissiles(etanks[j]->missile);minmissile[i]->drawMissile(p,etanks);}for(inti=0;ilive==0)minmissile.removeOne(minmissile[i]);}}for(intj=0;j<3&&jmissile.size();i++){if(etanks[j]->missile[i]->live==0)
etanks[j]->missile.removeOne(etanks[j]->missile[i]);}}for(inti=0;i<3&&iTankHitWalls(myWall);//所有敌军坦克与墙壁进行碰撞检测etanks[i]->drawTank(p);}for(intj=0;j<3&&jmissile.size();i++){//etanks[j]->missile[i]->hitTanks(etanks);//所有子弹与所有敌军坦克做碰撞检测etanks[j]->missile[i]->hitTank(mytank);//敌方子弹与主战坦克做碰撞检测etanks[j]->missile[i]->hitTank(mytank1);//敌方子弹与主战坦克做碰撞检测etanks[j]->missile[i]->hitWalls(myWall);//敌方子弹与所有墙壁做碰撞检测//if(j+1<3&&j+1missile[i]->hitMissiles(etanks[j+1]->missile);//所有子弹与子弹做碰撞检测etanks[j]->missile[i]->drawMissile(p,etanks);}}for(inti=0;idrawWall(p);}for(inti=0;idrawExplode(p);}for(inti=0;ilive==0){myWall.removeOne(myWall[i]);}}
if((!mytank->live&&!mytank1->live&&number==2)||(!mytank->live&&number==1))//如果墙被打光或者主战坦克挂了则显示gameover{start=false;gameover=true;step=0;}if(etanks.size()==0)//如果敌军坦克都挂了则显示victory{lastWhitchMap=WhitchMap;start=false;victory=true;WhitchMap++;step=0;}}elseif(choosemap){for(inti=0;ihide();}button[6]->hide();button[7]->hide();p.drawImage(120,150,chooseImgs[0]);p.drawImage(280,150,chooseImgs[1]);p.drawImage(440,150,chooseImgs[2]);p.drawImage(600,150,chooseImgs[3]);p.drawImage(760,150,chooseImgs[4]);p.drawImage(120,260,chooseImgs[5]);p.drawImage(280,260,chooseImgs[6]);p.drawImage(440,260,chooseImgs[7]);p.drawImage(600,260,chooseImgs[8]);p.drawImage(760,260,chooseImgs[9]);switch(a){case1:p.drawImage(120,150,chooseImgs[10]);p.drawImage(280,150,chooseImgs[1]);p.drawImage(440,150,chooseImgs[2]);p.drawImage(600,150,chooseImgs[3]);p.drawImage(760,150,chooseImgs[4]);p.drawImage(120,260,chooseImgs[5]);
p.drawImage(280,260,chooseImgs[6]);p.drawImage(440,260,chooseImgs[7]);p.drawImage(600,260,chooseImgs[8]);p.drawImage(760,260,chooseImgs[9]);break;case2:p.drawImage(120,150,chooseImgs[0]);p.drawImage(280,150,chooseImgs[11]);p.drawImage(440,150,chooseImgs[2]);p.drawImage(600,150,chooseImgs[3]);p.drawImage(760,150,chooseImgs[4]);p.drawImage(120,260,chooseImgs[5]);p.drawImage(280,260,chooseImgs[6]);p.drawImage(440,260,chooseImgs[7]);p.drawImage(600,260,chooseImgs[8]);p.drawImage(760,260,chooseImgs[9]);break;case3:p.drawImage(120,150,chooseImgs[0]);p.drawImage(280,150,chooseImgs[1]);p.drawImage(600,150,chooseImgs[3]);p.drawImage(760,150,chooseImgs[4]);p.drawImage(120,260,chooseImgs[5]);p.drawImage(280,260,chooseImgs[6]);p.drawImage(440,260,chooseImgs[7]);p.drawImage(600,260,chooseImgs[8]);p.drawImage(760,260,chooseImgs[9]);p.drawImage(440,150,chooseImgs[12]);break;case4:p.drawImage(120,150,chooseImgs[0]);p.drawImage(280,150,chooseImgs[1]);p.drawImage(440,150,chooseImgs[2]);p.drawImage(760,150,chooseImgs[4]);p.drawImage(120,260,chooseImgs[5]);p.drawImage(280,260,chooseImgs[6]);p.drawImage(440,260,chooseImgs[7]);p.drawImage(600,260,chooseImgs[8]);p.drawImage(760,260,chooseImgs[9]);p.drawImage(600,150,chooseImgs[13]);break;case5:p.drawImage(120,150,chooseImgs[0]);p.drawImage(280,150,chooseImgs[1]);
p.drawImage(440,150,chooseImgs[2]);p.drawImage(600,150,chooseImgs[3]);p.drawImage(120,260,chooseImgs[5]);p.drawImage(280,260,chooseImgs[6]);p.drawImage(440,260,chooseImgs[7]);p.drawImage(600,260,chooseImgs[8]);p.drawImage(760,260,chooseImgs[9]);p.drawImage(760,150,chooseImgs[14]);break;case6:p.drawImage(120,150,chooseImgs[0]);p.drawImage(280,150,chooseImgs[1]);p.drawImage(440,150,chooseImgs[2]);p.drawImage(600,150,chooseImgs[3]);p.drawImage(760,150,chooseImgs[4]);p.drawImage(280,260,chooseImgs[6]);p.drawImage(440,260,chooseImgs[7]);p.drawImage(600,260,chooseImgs[8]);p.drawImage(760,260,chooseImgs[9]);p.drawImage(120,260,chooseImgs[15]);break;case7:p.drawImage(120,150,chooseImgs[0]);p.drawImage(280,150,chooseImgs[1]);p.drawImage(440,150,chooseImgs[2]);p.drawImage(600,150,chooseImgs[3]);p.drawImage(760,150,chooseImgs[4]);p.drawImage(120,260,chooseImgs[5]);p.drawImage(440,260,chooseImgs[7]);p.drawImage(600,260,chooseImgs[8]);p.drawImage(760,260,chooseImgs[9]);p.drawImage(280,260,chooseImgs[16]);break;case8:p.drawImage(120,150,chooseImgs[0]);p.drawImage(280,150,chooseImgs[1]);p.drawImage(440,150,chooseImgs[2]);p.drawImage(600,150,chooseImgs[3]);p.drawImage(760,150,chooseImgs[4]);p.drawImage(120,260,chooseImgs[5]);p.drawImage(280,260,chooseImgs[6]);p.drawImage(600,260,chooseImgs[8]);p.drawImage(760,260,chooseImgs[9]);p.drawImage(440,260,chooseImgs[17]);
break;case9:p.drawImage(120,150,chooseImgs[0]);p.drawImage(280,150,chooseImgs[1]);p.drawImage(440,150,chooseImgs[2]);p.drawImage(600,150,chooseImgs[3]);p.drawImage(760,150,chooseImgs[4]);p.drawImage(120,260,chooseImgs[5]);p.drawImage(280,260,chooseImgs[6]);p.drawImage(440,260,chooseImgs[7]);p.drawImage(760,260,chooseImgs[9]);p.drawImage(600,260,chooseImgs[18]);break;case10:p.drawImage(120,150,chooseImgs[0]);p.drawImage(280,150,chooseImgs[1]);p.drawImage(440,150,chooseImgs[2]);p.drawImage(600,150,chooseImgs[3]);p.drawImage(760,150,chooseImgs[4]);p.drawImage(120,260,chooseImgs[5]);p.drawImage(280,260,chooseImgs[6]);p.drawImage(440,260,chooseImgs[7]);p.drawImage(600,260,chooseImgs[8]);p.drawImage(760,260,chooseImgs[19]);break;default:break;}button[5]->show();}else{//三种状态画if(gameover){p.drawImage(140,3*step,logoImgs[1]);p.drawImage(20,20,logoImgs[6]);}elseif(victory){p.drawImage(140,3*step,logoImgs[2]);p.drawImage(0,0,logoImgs[7]);}elsep.drawImage(140,3*step,MainWindow::logoImgs[0]);
step++;if(step>=40)step=40;//画按钮if(gameover){button[0]->setIcon(ButtonImgs[0]);button[0]->show();button[1]->hide();button[2]->hide();button[3]->hide();button[4]->show();button[5]->hide();button[6]->hide();button[7]->hide();}elseif(victory){button[0]->setIcon(ButtonImgs[5]);button[0]->show();button[1]->hide();button[2]->hide();button[3]->hide();button[4]->show();button[5]->hide();button[6]->hide();button[7]->hide();}else{if(pause){button[0]->hide();button[1]->hide();button[2]->hide();button[3]->hide();button[4]->hide();button[5]->hide();button[6]->show();button[7]->show();}else{for(inti=1;ishow();
button[0]->hide();button[5]->hide();button[6]->hide();button[7]->hide();}}}}voidMainWindow::timerEvent(QTimerEvent*e){if(e->timerId()==id1)update();if(e->timerId()==id2)b=1;}voidMainWindow::mousePressEvent(QMouseEvent*e){QPointmouse;mouse=e->globalPos()-pos();if(e->button()==Qt::LeftButton&&choosemap){if(mouse.x()<230&&mouse.x()>130&&mouse.y()>190&&mouse.y()<290){lastWhitchMap=WhitchMap;a=1;WhitchMap=0;}elseif(mouse.x()<390&&mouse.x()>290&&mouse.y()>190&&mouse.y()<290){lastWhitchMap=WhitchMap;a=2;WhitchMap=1;}elseif(mouse.x()<550&&mouse.x()>450&&mouse.y()>190&&mouse.y()<290){lastWhitchMap=WhitchMap;a=3;WhitchMap=2;}elseif(mouse.x()<710&&mouse.x()>610&&mouse.y()>190&&mouse.y()<290)
{lastWhitchMap=WhitchMap;a=4;WhitchMap=3;}elseif(mouse.x()<870&&mouse.x()>770&&mouse.y()>190&&mouse.y()<290){lastWhitchMap=WhitchMap;a=5;WhitchMap=4;}elseif(mouse.x()<210&&mouse.x()>110&&mouse.y()>300&&mouse.y()<400){lastWhitchMap=WhitchMap;a=6;WhitchMap=5;}elseif(mouse.x()<390&&mouse.x()>290&&mouse.y()>300&&mouse.y()<400){lastWhitchMap=WhitchMap;a=7;WhitchMap=6;}elseif(mouse.x()<550&&mouse.x()>450&&mouse.y()>300&&mouse.y()<400){lastWhitchMap=WhitchMap;a=8;WhitchMap=7;}elseif(mouse.x()<710&&mouse.x()>610&&mouse.y()>300&&mouse.y()<400){lastWhitchMap=WhitchMap;a=9;WhitchMap=8;}elseif(mouse.x()<870&&mouse.x()>770&&mouse.y()>300&&mouse.y()<400){lastWhitchMap=WhitchMap;
a=10;WhitchMap=9;}}}voidMainWindow::keyPressEvent(QKeyEvent*e){setFocus();//加了这句话,小键盘的上下左右就能用了switch(e->key()){caseQt::Key_F2:{step=0;start=!start;if(!(start))//暂停/继续{button[7]->show();pause=true;}break;caseQt::Key_F1:{//重启游戏while(mytank->missile.size())mytank->missile.removeOne(mytank->missile[0]);for(inti=0;imissile.size())etanks[i]->missile.removeOne(etanks[i]->missile[0]);while(etanks.size())etanks.removeOne(etanks[0]);while(myWall.size())myWall.removeOne(myWall[0]);AllObject();start=true;gameover=false;break;}caseQt::Key_Escape:mytank->keyPress(Qt::Key_Escape);break;default:break;}}if(mytank->live)mytank->keyPress(e->key());if(mytank1->live)
{mytank1->keyPress(e->key());}}voidMainWindow::keyReleaseEvent(QKeyEvent*e){if(mytank->live)mytank->keyRelease(e->key());if(mytank1->live)mytank1->keyRelease(e->key());}voidMainWindow::AllObject(){mytank=newTank(12*20,GAME_HEIGHT-40,40,40,this,true,100,4);//创建主战坦克对象mytank1=newTank(20*20,GAME_HEIGHT-40,40,40,this,true,100,5);//创建主战坦克对象for(intj=0;j<3;j++)//创建敌军坦克{for(inti=0;i<3;i++){Tank*t=newTank(340*i,0,40,40,this,false,50,2);etanks.push_back(t);}}for(intj=0;j<2;j++)//创建敌军坦克{for(inti=0;i<3;i++){Tank*t=newTank(340*i,0,40,40,this,false,75,1);etanks.push_back(t);}}for(intj=0;j<1;j++)//创建敌军坦克{for(inti=0;i<1;i++){Tank*t=newTank(340*i,0,40,40,this,false,100,0);etanks.push_back(t);}}for(inti=0;i<34;i++)//根据地图数组画地图{for(intj=0;j<34;j++){switch(map[WhitchMap][i][j])
{case1:{Wall*w=newWall((j)*20,(i)*20,20,20,0,this,100);myWall.push_back(w);break;}case2:{Wall*w=newWall((j)*20,(i)*20,20,20,1,this,100);myWall.push_back(w);break;}case3:{Wall*w=newWall((j)*20,(i)*20,20,20,2,this,100);myWall.push_back(w);break;}case4:{Wall*w=newWall((j)*20,(i)*20,20,20,3,this,100);myWall.push_back(w);break;}default:break;}}}}voidMainWindow::Music(){//背景音乐backgoundMusic=newPhonon::MediaObject(this);backgoundMusic->setCurrentSource(Phonon::MediaSource("../mytank/sounds/background.mp3"));Phonon::AudioOutput*backgroundMusicOutput=newPhonon::AudioOutput(Phonon::MusicCategory,this);Phonon::createPath(backgoundMusic,backgroundMusicOutput);connect(backgoundMusic,SIGNAL(finished()),backgoundMusic,SLOT(stop()));//开挂时的背景音乐
backgoundMusic1=newPhonon::MediaObject(this);backgoundMusic1->setCurrentSource(Phonon::MediaSource("../mytank/sounds/background1.mp3"));Phonon::AudioOutput*backgroundMusic1Output=newPhonon::AudioOutput(Phonon::MusicCategory,this);Phonon::createPath(backgoundMusic1,backgroundMusic1Output);connect(backgoundMusic1,SIGNAL(finished()),backgoundMusic1,SLOT(stop()));//我方子弹打死玻璃boom_woodMusic=newPhonon::MediaObject(this);boom_woodMusic->setCurrentSource(Phonon::MediaSource("../mytank/sounds/boom_wood.wav"));Phonon::AudioOutput*boom_woodMusicOutput=newPhonon::AudioOutput(Phonon::MusicCategory,this);Phonon::createPath(boom_woodMusic,boom_woodMusicOutput);//我方子弹0发射missile0_shootMusic=newPhonon::MediaObject(this);missile0_shootMusic->setCurrentSource(Phonon::MediaSource("../mytank/sounds/missile0_shoot.wav"));Phonon::AudioOutput*missile0_shootMusicOutput=newPhonon::AudioOutput(Phonon::MusicCategory,this);Phonon::createPath(missile0_shootMusic,missile0_shootMusicOutput);//我方子弹1发射missile1_shootMusic=newPhonon::MediaObject(this);missile1_shootMusic->setCurrentSource(Phonon::MediaSource("../mytank/sounds/missile1_shootMusic.wav"));Phonon::AudioOutput*missile1_shootMusicOutput=newPhonon::AudioOutput(Phonon::MusicCategory,this);Phonon::createPath(missile1_shootMusic,missile1_shootMusicOutput);//我方子弹2发射missile2_shootMusic=newPhonon::MediaObject(this);missile2_shootMusic->setCurrentSource(Phonon::MediaSource("../mytank/sounds/missile2_shootMusic.wav"));Phonon::AudioOutput*missile2_shootMusicOutput=newPhonon::AudioOutput(Phonon::MusicCategory,this);Phonon::createPath(missile2_shootMusic,missile2_shootMusicOutput);
//我方子弹3发射missile3_shootMusic=newPhonon::MediaObject(this);missile3_shootMusic->setCurrentSource(Phonon::MediaSource("../mytank/sounds/missile3_shootMusic.wav"));Phonon::AudioOutput*missile3_shootMusicOutput=newPhonon::AudioOutput(Phonon::MusicCategory,this);Phonon::createPath(missile3_shootMusic,missile3_shootMusicOutput);//我方子弹4发射missile4_shootMusic=newPhonon::MediaObject(this);missile4_shootMusic->setCurrentSource(Phonon::MediaSource("../mytank/sounds/missile4_shootMusic.wav"));Phonon::AudioOutput*missile4_shootMusicOutput=newPhonon::AudioOutput(Phonon::MusicCategory,this);Phonon::createPath(missile4_shootMusic,missile4_shootMusicOutput);//猪死pig_deadMusic=newPhonon::MediaObject(this);pig_deadMusic->setCurrentSource(Phonon::MediaSource("../mytank/sounds/pig_deadMusic.wav"));Phonon::AudioOutput*pig_deadMusicOutput=newPhonon::AudioOutput(Phonon::MusicCategory,this);Phonon::createPath(pig_deadMusic,pig_deadMusicOutput);//玩家受到伤害player_injuryMusic=newPhonon::MediaObject(this);player_injuryMusic->setCurrentSource(Phonon::MediaSource("../mytank/sounds/player_injuryMusic.wav"));Phonon::AudioOutput*player_injuryMusicOutput=newPhonon::AudioOutput(Phonon::MusicCategory,this);Phonon::createPath(player_injuryMusic,player_injuryMusicOutput);}voidMainWindow::Buttons(){QPushButton*restartGame=newQPushButton(this);//重来、下一关、继续button.push_back(restartGame);QPushButton*startGame=newQPushButton(this);//单人button.push_back(startGame);QPushButton*DoubleGame=newQPushButton(this);//双人button.push_back(DoubleGame);QPushButton*ChooseGame=newQPushButton(this);//选关
button.push_back(ChooseGame);QPushButton*exitGame=newQPushButton(this);//退出button.push_back(exitGame);QPushButton*backmenu=newQPushButton(this);//返回菜单button.push_back(backmenu);QPushButton*back=newQPushButton(this);//返回button.push_back(back);QPushButton*pausegame=newQPushButton(this);//暂停button.push_back(pausegame);button[0]->setGeometry(450,250,100,50);//setGeometry()函数中第1,2个参数代表按键对象的左上角,第3,4个参数代表按键对象按键对象的大小button[1]->setGeometry(450,300,100,50);button[2]->setGeometry(450,350,100,50);button[3]->setGeometry(450,400,100,50);button[4]->setGeometry(450,450,100,50);button[5]->setGeometry(450,500,100,50);button[6]->setGeometry(450,450,100,50);button[7]->setGeometry(450,300,100,50);connect(button[0],SIGNAL(clicked()),this,SLOT(pressRestart()));//重来connect(button[1],SIGNAL(clicked()),this,SLOT(pressStartone()));//单人开始connect(button[2],SIGNAL(clicked()),this,SLOT(pressStarttwo()));//双人connect(button[3],SIGNAL(clicked()),this,SLOT(chooseMap()));//选关connect(button[4],SIGNAL(clicked()),this,SLOT(close()));//退出connect(button[6],SIGNAL(clicked()),this,SLOT(back()));//返回菜单connect(button[5],SIGNAL(clicked()),this,SLOT(backMenu()));//返回connect(button[7],SIGNAL(clicked()),this,SLOT(startgame()));//开始restartGame->setIcon(ButtonImgs[0]);startGame->setIcon(ButtonImgs[1]);DoubleGame->setIcon(ButtonImgs[2]);ChooseGame->setIcon(ButtonImgs[3]);exitGame->setIcon(ButtonImgs[4]);backmenu->setIcon(ButtonImgs[7]);back->setIcon(ButtonImgs[7]);pausegame->setIcon(ButtonImgs[6]);restartGame->setIconSize(QSize(150,50));startGame->setIconSize(QSize(150,50));DoubleGame->setIconSize(QSize(150,50));ChooseGame->setIconSize(QSize(150,50));
exitGame->setIconSize(QSize(150,50));backmenu->setIconSize(QSize(150,50));back->setIconSize(QSize(150,50));pausegame->setIconSize(QSize(150,50));}voidMainWindow::pressStartone(){while(mytank->missile.size())mytank->missile.removeOne(mytank->missile[0]);while(minmissile.size())minmissile.removeOne(minmissile[0]);for(inti=0;imissile.size())etanks[i]->missile.removeOne(etanks[i]->missile[0]);while(etanks.size())etanks.removeOne(etanks[0]);while(myWall.size())myWall.removeOne(myWall[0]);AllObject();start=true;number=1;}voidMainWindow::pressStarttwo(){while(mytank->missile.size())mytank->missile.removeOne(mytank->missile[0]);while(mytank1->missile.size())mytank->missile.removeOne(mytank->missile[0]);while(minmissile.size())minmissile.removeOne(minmissile[0]);for(inti=0;imissile.size())etanks[i]->missile.removeOne(etanks[i]->missile[0]);while(etanks.size())etanks.removeOne(etanks[0]);while(myWall.size())myWall.removeOne(myWall[0]);AllObject();start=true;number=2;}voidMainWindow::pressRestart(){mytank->keyPress(Qt::Key_F1);
}voidMainWindow::chooseMap(){choosemap=true;}voidMainWindow::backMenu(){choosemap=false;a=0;}voidMainWindow::back(){button[2]->show();button[3]->show();button[1]->setIcon(ButtonImgs[1]);button[6]->hide();pause=!pause;}voidMainWindow::startgame(){start=true;}Missile.cpp#include"missile.h"#include#include"MainWindow.h"#include#include"tank.h"#include"explode.h"#include"wall.h"QListMissile::missileImgs;Missile::Missile(intx,inty,intw,inth,Dirdir,MainWindow*tc,boolgood,inttype){this->x=x;this->y=y;this->w=w;this->h=h;this->dir=dir;live=true;this->tc=tc;tlive=true;
livewall=true;this->good=good;this->type=type;}voidMissile::drawMissile(QPainter&p,QListts){if(live){if(good){switch(type){case0:switch(dir){caseU:p.drawImage(x,y,missileImgs[0]);break;caseD:p.drawImage(x,y,missileImgs[1]);break;caseL:p.drawImage(x,y,missileImgs[2]);break;caseR:p.drawImage(x,y,missileImgs[3]);break;default:break;}break;case1:switch(dir){caseU:p.drawImage(x,y,missileImgs[4]);break;caseD:p.drawImage(x,y,missileImgs[5]);break;caseL:p.drawImage(x,y,missileImgs[6]);break;caseR:p.drawImage(x,y,missileImgs[7]);break;default:break;}break;case2:switch(dir){caseU:p.drawImage(x,y,missileImgs[8]);break;caseD:p.drawImage(x,y,missileImgs[9]);break;caseL:p.drawImage(x,y,missileImgs[10]);break;caseR:p.drawImage(x,y,missileImgs[11]);break;default:break;}break;case3:switch(dir)
{caseU:p.drawImage(x,y,missileImgs[12]);break;caseD:p.drawImage(x,y,missileImgs[13]);break;caseL:p.drawImage(x,y,missileImgs[14]);break;caseR:p.drawImage(x,y,missileImgs[15]);break;default:break;}break;case4:switch(dir){caseU:p.drawImage(x,y,missileImgs[17]);break;caseD:p.drawImage(x,y,missileImgs[18]);break;caseL:p.drawImage(x,y,missileImgs[19]);break;caseR:p.drawImage(x,y,missileImgs[20]);break;default:break;}break;case5:switch(dir){caseU:p.drawImage(x,y,missileImgs[8]);break;caseD:p.drawImage(x,y,missileImgs[9]);break;caseL:p.drawImage(x,y,missileImgs[10]);break;caseR:p.drawImage(x,y,missileImgs[11]);break;default:break;}default:break;}}elsep.drawImage(x,y,missileImgs[16]);moveMissile(ts);}}voidMissile::moveMissile(QListts){if(type==1){switch(dir){caseU:y-=12;break;caseD:y+=12;break;caseL:x-=12;break;
caseR:x+=12;break;default:break;}}elseif(type==4){if(ts[0]->x>x+10)dir=R;elseif(ts[0]->xy>y+10)dir=D;elseif(ts[0]->y=MainWindow::GAME_HEIGHT-15||y>=MainWindow::GAME_HEIGHT-15)live=false;}boolMissile::hitTank(Tank*t){if(live&&t->live&&good!=t->good&&this->getRect().intersects(t->getRect())){//我方子弹打到猪,猪叫if(good){
tc->pig_deadMusic->stop();tc->pig_deadMusic->play();}//敌方子弹打到我,我叫else{tc->player_injuryMusic->stop();tc->player_injuryMusic->play();}if(type==1){if(t->liveValue>=50&&tlive){t->liveValue-=50;live=false;tlive=false;}elseif(t->liveValue<=25&&tlive){t->liveValue-=25;tlive=false;}elseif(t->liveValue>=50&&!tlive){t->liveValue-=25;live=false;}elseif(t->liveValue<=25&&!tlive){t->liveValue-=25;live=false;}}else{if(type!=4)live=false;tlive=false;t->liveValue-=25;}if(t->liveValue==0){t->live=false;Explode*e=newExplode(t->x,t->y,tc,0,false);//创建爆炸对象
tc->explodes.push_back(e);}if(live==0){Explode*e=newExplode(x,y,tc,type+1,good);//创建爆炸对象tc->explodes.push_back(e);}returntrue;}returnfalse;}voidMissile::hitTanks(QListts){for(inti=0;i<3&&igetRect().intersects(w->getRect())){switch(w->whatwall){case0:{if(good){tc->boom_woodMusic->stop();tc->boom_woodMusic->play();}livewall=false;w->live=false;if(live==0){Explode*e=newExplode(x,y,tc,type+1,good);//创建爆炸对象tc->explodes.push_back(e);}returntrue;}case1:case2:{break;}case3:
{livewall=false;tlive=false;returntrue;}}}if(live&&this->getRect().intersects(QRect(320,640,40,40))){tc->gameover=true;tc->victory=false;tc->start=false;returntrue;}returnfalse;}voidMissile::hitWalls(QListws){if(type==1){if(tlive){for(inti=0;i=0;i--){if(hitWall(ws[i]))break;}if(!livewall)tlive=false;livewall=true;}else{for(inti=0;i=0;i--){if(hitWall(ws[i]))break;}if(!livewall)live=false;
livewall=true;}}else{for(inti=0;i=0;i--){if(hitWall(ws[i]))break;}if(!livewall&&type!=4)live=false;}if(live==0){Explode*e=newExplode(x,y,tc,type+1,good);//创建爆炸对象tc->explodes.push_back(e);}}boolMissile::hitMissile(Missile*m){if(type==1){if(live&&m->live&&this->good!=m->good&&this->getRect().intersects(m->getRect())){m->live=false;if(tlive)tlive=false;elselive=false;if(live==0){Explode*e=newExplode(x,y,tc,type+1,good);//创建爆炸对象tc->explodes.push_back(e);}returntrue;}}else
{if(live&&m->live&&this->good!=m->good&&this->getRect().intersects(m->getRect())){if(type!=4)live=false;m->live=false;if(live==0){Explode*e=newExplode(x,y,tc,type+1,good);//创建爆炸对象tc->explodes.push_back(e);}returntrue;}}returnfalse;}voidMissile::hitMissiles(QListms){for(intj=0;j#include"missile.h"#include"MainWindow.h"//#include"explode.h"#include"wall.h"externQListminmissile;externintid2;externintb;Tank::Tank(intx,inty,intw,inth,MainWindow*tc,boolgood,intliveValue,intkind){this->x=x;this->y=y;this->w=w;this->h=h;BU=BD=BL=BR=false;
this->tc=tc;dir=STOP;ptDir=U;this->good=good;live=true;step=63;xtemp=ytemp=0;count=8;this->liveValue=liveValue;this->kind=kind;}voidTank::drawTank(QPainter&p){if(!live){tc->etanks.removeOne(this);return;}if(good)count=0;if(dir!=STOP)ptDir=dir;if(good==true){if(kind==4)switch(ptDir){caseU:p.drawImage(x,y,mytankImgs[0]);break;caseD:p.drawImage(x,y,mytankImgs[1]);break;caseL:p.drawImage(x,y,mytankImgs[2]);break;caseR:p.drawImage(x,y,mytankImgs[3]);break;default:break;}if(kind==5)switch(ptDir){caseU:p.drawImage(x,y,mytankImgs[4]);break;caseD:p.drawImage(x,y,mytankImgs[5]);break;caseL:p.drawImage(x,y,mytankImgs[6]);break;caseR:p.drawImage(x,y,mytankImgs[7]);break;default:break;}}else
{if(step!=0&&count){if((step<=63&&step>=47)||(step<=30&&step>=16))p.drawImage(x,y,enemytankImgs[9]);if((step<=47&&step>=31)||(step<=15&&step>0))p.drawImage(x,y,enemytankImgs[10]);}else{if(kind==0){switch(liveValue){case100:p.drawImage(x,y,enemytankImgs[0]);break;case75:p.drawImage(x,y,enemytankImgs[1]);break;case50:p.drawImage(x,y,enemytankImgs[2]);break;case25:p.drawImage(x,y,enemytankImgs[3]);break;default:break;}}if(kind==1){switch(liveValue){case75:p.drawImage(x,y,enemytankImgs[6]);break;case50:p.drawImage(x,y,enemytankImgs[7]);break;case25:p.drawImage(x,y,enemytankImgs[8]);break;default:break;}}if(kind==2){switch(liveValue){case50:p.drawImage(x,y,enemytankImgs[4]);break;case25:p.drawImage(x,y,enemytankImgs[5]);break;default:break;}}}}moveTank();}
voidTank::keyPress(intkey){if(kind==4){switch(key){caseQt::Key_W:BU=true;break;caseQt::Key_S:BD=true;break;caseQt::Key_A:BL=true;break;caseQt::Key_D:BR=true;break;caseQt::Key_J:fire(0);break;caseQt::Key_K:fire(1);break;caseQt::Key_L:fire(2);break;caseQt::Key_I:fire(3);break;caseQt::Key_F4:fire(4);break;default:break;}}if(kind==5){switch(key){caseQt::Key_Up:BU=true;break;caseQt::Key_Down:BD=true;break;caseQt::Key_Left:BL=true;break;caseQt::Key_Right:BR=true;break;caseQt::Key_0:fire(0);break;caseQt::Key_1:fire(1);break;caseQt::Key_2:fire(2);break;caseQt::Key_3:fire(3);break;default:break;}}switch(key){caseQt::Key_F1:{//重启游戏while(minmissile.size())minmissile.removeOne(minmissile[0]);while(tc->mytank->missile.size())tc->mytank->missile.removeOne(tc->mytank->missile[0]);while(tc->mytank1->missile.size())
tc->mytank1->missile.removeOne(tc->mytank1->missile[0]);for(inti=0;ietanks.size();i++)while(tc->etanks[i]->missile.size())tc->etanks[i]->missile.removeOne(tc->etanks[i]->missile[0]);while(tc->etanks.size())tc->etanks.removeOne(tc->etanks[0]);while(tc->myWall.size())tc->myWall.removeOne(tc->myWall[0]);tc->AllObject();tc->start=true;tc->gameover=false;break;}caseQt::Key_Escape:exit(0);break;//退出游戏default:break;}if(BU&&!BD&&!BL&&!BR)dir=U;elseif(!BU&&BD&&!BL&&!BR)dir=D;elseif(!BU&&!BD&&BL&&!BR)dir=L;elseif(!BU&&!BD&&!BL&&BR)dir=R;elsedir=STOP;}voidTank::keyRelease(intkey){if(kind==4){switch(key){caseQt::Key_W:BU=false;break;caseQt::Key_S:BD=false;break;caseQt::Key_A:BL=false;break;caseQt::Key_D:BR=false;break;default:break;}}elseif(kind==5){switch(key){caseQt::Key_Up:BU=false;break;caseQt::Key_Down:BD=false;break;caseQt::Key_Left:BL=false;break;
caseQt::Key_Right:BR=false;break;default:break;}}if(BU&&!BD&&!BL&&!BR)dir=U;elseif(!BU&&BD&&!BL&&!BR)dir=D;elseif(!BU&&!BD&&BL&&!BR)dir=L;elseif(!BU&&!BD&&!BL&&BR)dir=R;elsedir=STOP;}voidTank::moveTank(){xtemp=x;ytemp=y;switch(dir){caseU:y-=5;break;caseD:y+=5;break;caseL:x-=5;break;caseR:x+=5;break;default:break;}if(x<=0)x=0;//防止tank与边界碰撞if(y<=0)y=0;if(x>=MainWindow::GAME_HEIGHT-w)x=MainWindow::GAME_HEIGHT-w;if(y>=MainWindow::GAME_HEIGHT-h)y=MainWindow::GAME_HEIGHT-h;if(!good){if(step!=0&&count){dir=Dir(4);}else{if(qrand()%20>10){fire(0);}if(step==0){dir=Dir(qrand()%4);step=qrand()%5+20;}count=0;
}step--;}}voidTank::fire(inttype){intmw=15;intmh=15;intmx=x;intmy=y;switch(ptDir){caseU:{mx=x+w/2-mw/2;my=y-mw;}break;caseD:{mx=x+w/2-mw/2;my=y+w;}break;caseL:{mx=x-mw;my=y+w/2-mh/2;}break;caseR:{mx=x+w;my=y+w/2-mh/2;}break;default:break;}if(missile.size()<2){if(good){if(type==0){
tc->missile0_shootMusic->stop();tc->missile0_shootMusic->play();}if(type==1){tc->missile1_shootMusic->stop();tc->missile1_shootMusic->play();}if(type==2){tc->missile2_shootMusic->stop();tc->missile2_shootMusic->play();}if(type==3){tc->missile3_shootMusic->stop();tc->missile3_shootMusic->play();}if(type==4){tc->missile4_shootMusic->stop();tc->missile4_shootMusic->play();}}Missile*m=newMissile(mx,my,mw,mh,ptDir,tc,good,type);missile.push_back(m);b=0;}}boolTank::TankHitWall(Wall*w)//检测坦克和墙壁是否碰撞{if(live&&getRect().intersects(w->getRect())&&w->whatwall!=1){x=xtemp;//回到上一次的位置y=ytemp;returntrue;}returnfalse;}voidTank::TankHitWalls(QListws){for(inti=0;i#include"missile.h"#include"MainWindow.h"QListWall::wallImgs;Wall::Wall(intx,inty,intw,inth,intwhatwall,MainWindow*tc,intliveValue){this->x=x;this->y=y;this->w=w;this->h=h;this->tc=tc;this->whatwall=whatwall;this->live=true;this->liveValue=liveValue;}voidWall::drawWall(QPainter&p){if(!live){return;}switch(whatwall){case0:{p.drawImage(x,y,Wall::wallImgs[0]);break;}case1:{p.drawImage(x,y,Wall::wallImgs[1]);break;}case2:{p.drawImage(x,y,Wall::wallImgs[2]);
break;}case3:{p.drawImage(x,y,Wall::wallImgs[3]);break;}default:break;}}'
您可能关注的文档
- 建昌中盛加油站建设项目报告表
- 山东滨州三力机械制造有限公司生产铸造件、锻造件、五金制品及其它设备配件项目报告表
- 和合治疗项目报告书
- 黑山羊养殖扶贫资金申请项目报告书
- 机构认知及分析实训项目报告
- 《柳城县三星纸厂项目项目报告书简本》
- 天津xxx大街项目报告 (2)
- 宁夏汇丰加油加气站项目报告表-贺兰
- 天津地区图书馆员刻板印象实证研究项目报告.doc
- 亲子户外探索活动对家校合作的调查研究项目报告书
- 丽江纳芮天然香料植物园项目报告
- 天津xxx大街项目报告 (3)
- 本科毕业设计论文--《javaee编程课程设计》期末项目报告书旅游信息管理系统.doc
- 黄河水院建设项目报告书
- 淳安县肉类加工厂搬迁重建项目报告表-简本
- 建设项目报告表-榆阳区
- 建设项目报告表-苏州工业园区——智慧社区
- 省某某出版集团绩效薪酬管理改革项目报告