• 47.00 KB
  • 18页

java雷电游戏项目报告模板

  • 18页
  • 当前文档由用户上传发布,收益归属用户
  1. 1、本文档共5页,可阅读全部内容。
  2. 2、本文档内容版权归属内容提供方,所产生的收益全部归内容提供方所有。如果您对本文有版权争议,可选择认领,认领后既往收益都归您。
  3. 3、本文档由用户上传,本站不保证质量和数量令人满意,可能有诸多瑕疵,付费之前,请仔细先通过免费阅读内容等途径辨别内容交易风险。如存在严重挂羊头卖狗肉之情形,可联系本站下载客服投诉处理。
  4. 文档侵权举报电话:19940600175。
'北京青年政治学院小学期达内JAVA课程项目报告项目题目:雷电游戏的设计与实现专业班级:学生姓名:学生学号:指导教师姓名:otherstaffoftheCentre.Duringthewar,ZhuwastransferredbacktoJiangxi,andDirectorofthenewOfficeinJingdezhen,JiangxiCommitteeSecretary.Startingin1939servedasrecorderoftheWestNorthOrganization,SecretaryoftheSpecialCommitteeAfterthevictoryofthelongMarch,hehasbeentheNorthwestOfficeoftheFederationofStateenterprisesMinister,ShenmufuguSARmissions,DirectorofNingxiaCountypartyCommitteeSecretaryandrecorderoftheCountypartyCommitteeSecretary,Ministersand17 目录一、系统目标X二、系统设计思路X三、系统详细设计X四、系统实现X五、系统设计总结XX六、参考文献XXotherstaffoftheCentre.Duringthewar,ZhuwastransferredbacktoJiangxi,andDirectorofthenewOfficeinJingdezhen,JiangxiCommitteeSecretary.Startingin1939servedasrecorderoftheWestNorthOrganization,SecretaryoftheSpecialCommitteeAfterthevictoryofthelongMarch,hehasbeentheNorthwestOfficeoftheFederationofStateenterprisesMinister,ShenmufuguSARmissions,DirectorofNingxiaCountypartyCommitteeSecretaryandrecorderoftheCountypartyCommitteeSecretary,Ministersand17 一、系统目标通过本游戏的设计,综合自己在校期间所学的理论知识,设计开发雷电游戏,使自己熟应用系统的开发过程,培养独立思考能力,检验学习效果和动手能力,初步掌握软件工程的系统理论,进一步巩固和加强自身对J2SE基础知识的理解,提高自己的编程水平,从而达到理论与实践相结合的目的。通过本游戏的开发,主要实现游戏的可操作性及美观性,同时使自己对JAVA语言的了解更进一层,为将来的实际工作打下坚实的基础。二、系统设计思路1、定义窗口的属性2、分别设置背景图片,英雄飞机图片,敌机图片,子弹图片,爆炸的图片3、分别设置敌机和英雄飞机的运动轨迹4、写出判断敌机是否与英雄飞机相撞,子弹是否击中敌机的代码5、设置一些丰富游戏的细致属性,例:绘制积分情况和血量图,子弹发射的频率等三、系统详细设计1、定义窗口属性(1)创建一个窗体对象(2)设置窗体的标题(3)设置窗体的大小(4)关闭窗口时退出程序(5)设置窗体在屏幕当中显示的位置(6)设置窗体的显示otherstaffoftheCentre.Duringthewar,ZhuwastransferredbacktoJiangxi,andDirectorofthenewOfficeinJingdezhen,JiangxiCommitteeSecretary.Startingin1939servedasrecorderoftheWestNorthOrganization,SecretaryoftheSpecialCommitteeAfterthevictoryofthelongMarch,hehasbeentheNorthwestOfficeoftheFederationofStateenterprisesMinister,ShenmufuguSARmissions,DirectorofNingxiaCountypartyCommitteeSecretaryandrecorderoftheCountypartyCommitteeSecretary,Ministersand17 注:游戏面板应做到1、继承JPanel2、实现相应的接口线程和鼠标监听事件2、定义并设置游戏中的主要元素(1)定义一个英雄飞机并对其属性进行设置(2)定义一个存放英雄机子弹的集合(3)定义存储敌机的数组,敌机初始化值为10并将其放入到数组当中(4)创建一个生成随机数的Random对象(5)定义一个存放爆炸图片的集合(6)设置敌机的属性,并将创建好的敌机添加到数组当中(7)绘制图片。分别绘制英雄机的子弹,英雄飞机,敌机,爆炸图片(8)对子弹的设置。将创建的子弹添加到存放子弹的集合当中,控制子弹的发射频率,让子弹飞,得到集合中的每一个子弹,当鼠标的某一个键按下时,发射子弹,英雄机子弹自动移动等。(9)写出鼠标点击,释放,拖拽时调用的方法代码3、做判断时所用的代码编写(1)判断子弹是否击中敌机获取敌机的中心坐标判断是否击中敌机的心脏(2)判断敌机是否与英雄机相撞等4、丰富游戏的设置绘制得分情况,绘制英雄飞机血量图和游戏结束等字体四、系统实现(游戏代码展示)importjava.awt.Color;importjava.awt.Font;importjava.awt.Graphics;importjava.awt.event.MouseEvent;importjava.awt.event.MouseListener;importjava.awt.event.MouseMotionListener;otherstaffoftheCentre.Duringthewar,ZhuwastransferredbacktoJiangxi,andDirectorofthenewOfficeinJingdezhen,JiangxiCommitteeSecretary.Startingin1939servedasrecorderoftheWestNorthOrganization,SecretaryoftheSpecialCommitteeAfterthevictoryofthelongMarch,hehasbeentheNorthwestOfficeoftheFederationofStateenterprisesMinister,ShenmufuguSARmissions,DirectorofNingxiaCountypartyCommitteeSecretaryandrecorderoftheCountypartyCommitteeSecretary,Ministersand17 importjava.util.ArrayList;importjava.util.List;importjava.util.Random;importjavax.swing.ImageIcon;importjavax.swing.JPanel;publicclassGamePanelextendsJPanelimplementsRunnable,MouseListener,MouseMotionListener{privateFlightheroFlight;privateListheroFires;//定义存储敌机的数组privateFlight[]flights;//初始化敌机为10架privateintnum=10;//创建一个生成随机数的Random对象privateRandomran=newRandom();//定义一个统计积分的属性privateintscore;//定义一个存放爆炸图片的集合privateListbomPics;otherstaffoftheCentre.Duringthewar,ZhuwastransferredbacktoJiangxi,andDirectorofthenewOfficeinJingdezhen,JiangxiCommitteeSecretary.Startingin1939servedasrecorderoftheWestNorthOrganization,SecretaryoftheSpecialCommitteeAfterthevictoryofthelongMarch,hehasbeentheNorthwestOfficeoftheFederationofStateenterprisesMinister,ShenmufuguSARmissions,DirectorofNingxiaCountypartyCommitteeSecretaryandrecorderoftheCountypartyCommitteeSecretary,Ministersand17 //创建面板的构造器,对属性进初始化publicGamePanel(){//创建存放爆炸图片集合的对象bomPics=newArrayList();//创建英雄飞机的对象,并对其属性进行设置heroFlight=newFlight();heroFlight.setWidth(80);heroFlight.setHeight(80);heroFlight.setX(200);heroFlight.setY(300);heroFlight.setDirection(Flight.UP);heroFlight.setImage(newImageIcon("src/images/hero.gif").getImage());heroFlight.setPanel(this);heroFlight.setSpeed(3);heroFlight.setWasFire(false);heroFlight.setBload(100);//创建存储英雄子弹的集合对象heroFires=newArrayList();//对存放敌机的数组进行创建并进行元素的初始化flights=newFlight[num];otherstaffoftheCentre.Duringthewar,ZhuwastransferredbacktoJiangxi,andDirectorofthenewOfficeinJingdezhen,JiangxiCommitteeSecretary.Startingin1939servedasrecorderoftheWestNorthOrganization,SecretaryoftheSpecialCommitteeAfterthevictoryofthelongMarch,hehasbeentheNorthwestOfficeoftheFederationofStateenterprisesMinister,ShenmufuguSARmissions,DirectorofNingxiaCountypartyCommitteeSecretaryandrecorderoftheCountypartyCommitteeSecretary,Ministersand17 //创建敌机并将其放入到数组当中for(inti=0;i0){//绘制英雄机的子弹for(inti=0;ithis.getHeight()){flights[i].setY(-ran.nextInt(500));flights[i].setX(ran.nextInt(500));}}if(heroFlight.isWasFire()&&count%10==0){//说明发射子弹,创建子弹对象FireheroFire=newFire();heroFire.setWidth(40);heroFire.setHeight(40);heroFire.setX(heroFlight.getX()+heroFire.getWidth()/2);otherstaffoftheCentre.Duringthewar,ZhuwastransferredbacktoJiangxi,andDirectorofthenewOfficeinJingdezhen,JiangxiCommitteeSecretary.Startingin1939servedasrecorderoftheWestNorthOrganization,SecretaryoftheSpecialCommitteeAfterthevictoryofthelongMarch,hehasbeentheNorthwestOfficeoftheFederationofStateenterprisesMinister,ShenmufuguSARmissions,DirectorofNingxiaCountypartyCommitteeSecretaryandrecorderoftheCountypartyCommitteeSecretary,Ministersand17 heroFire.setY(heroFlight.getY());heroFire.setDirection(Fire.UP);heroFire.setSpeed(5);heroFire.setImage(newImageIcon("src/images/fire.gif").getImage());heroFire.setPanel(this);//将创建的子弹添加到存放子弹的集合当中heroFires.add(heroFire);}//让子弹飞for(inti=0;i0){//判断敌机是否撞击英雄机for(inti=0;iheroFire.getX()&&x<=(heroFire.getX()+heroFire.getWidth())&&y>heroFire.getY()&&y<=(heroFire.getY()+heroFire.getHeight())){returntrue;}returnfalse;}}五、系统设计总结六、参考文献otherstaffoftheCentre.Duringthewar,ZhuwastransferredbacktoJiangxi,andDirectorofthenewOfficeinJingdezhen,JiangxiCommitteeSecretary.Startingin1939servedasrecorderoftheWestNorthOrganization,SecretaryoftheSpecialCommitteeAfterthevictoryofthelongMarch,hehasbeentheNorthwestOfficeoftheFederationofStateenterprisesMinister,ShenmufuguSARmissions,DirectorofNingxiaCountypartyCommitteeSecretaryandrecorderoftheCountypartyCommitteeSecretary,Ministersand17'