版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
常州工學(xué)院學(xué)士學(xué)位設(shè)計(jì)PAGEPAGE18目錄一設(shè)計(jì)分析………………………31.設(shè)計(jì)目標(biāo)……………32.主要內(nèi)容……………3二設(shè)計(jì)說明……………………41.游戲邏輯……………42.技術(shù)分工……………43.設(shè)計(jì)方法……………5三成果展示……………………61.運(yùn)行截圖………………62.程序代碼………………7四結(jié)束語(yǔ)………………………18五致謝……………18六參考文獻(xiàn)……………………18
一設(shè)計(jì)分析一.設(shè)計(jì)目標(biāo):此項(xiàng)目是模仿PopCapGames公司開發(fā)的一款同名游戲《植物大戰(zhàn)僵尸》而開發(fā)的,是一款益智策略類單機(jī)游戲,玩家通過武裝多種植物切換不同的功能,快速有效地把僵尸阻擋在入侵的道路上。不同的敵人,不同的玩法,游戲的內(nèi)容就是:玩家控制植物,抵御僵尸的進(jìn)攻,保護(hù)主人的屋子。此游戲?qū)ν婕业囊笠彩谴竽X的智慧和小腦的反應(yīng),玩家可以從游戲中獲得成就感和戰(zhàn)略思維。特點(diǎn):1、冒險(xiǎn)模式。2、有不同的敵人和可使用道具,使游戲更具挑戰(zhàn)性。3、無(wú)限次重玩,不會(huì)經(jīng)歷兩次同樣的事件。二.設(shè)計(jì)內(nèi)容:通過玩家對(duì)不同植物的選擇,例如向日葵可快速產(chǎn)生陽(yáng)光,豌豆射手可攻擊敵人等等,來(lái)操作游戲,后臺(tái)通過調(diào)整時(shí)間和參數(shù)達(dá)到前端界面游戲的可玩性。功能類別子功能前端游戲界面主界面模式選擇進(jìn)入游戲確定關(guān)卡退出后臺(tái)代碼設(shè)計(jì)選擇、放置植物陽(yáng)光生產(chǎn)時(shí)間收集陽(yáng)光產(chǎn)生僵尸攻擊、殺死僵尸二設(shè)計(jì)說明1游戲邏輯(1)僵尸是攻擊方,為了攻擊,防御僵尸,人類通過栽種培植出的各種植物來(lái)抵御進(jìn)攻型僵尸的攻擊。植物需要相應(yīng)的陽(yáng)光值成長(zhǎng)。(2)在作戰(zhàn)地點(diǎn),玩家需要通過種植各種攻擊植物來(lái)消滅僵尸,也可以通過種防御植物來(lái)阻擋僵尸,還需要太陽(yáng)花來(lái)產(chǎn)生種植需要的陽(yáng)光。3僵尸作戰(zhàn)單位(1)普通僵尸。速度(1幀),血限3,毀掉植物需要3s。4植物作戰(zhàn)單位(1)太陽(yáng)花。種植需陽(yáng)光值50,作用:生產(chǎn)種植所需的陽(yáng)光值,每隔10s生產(chǎn)50點(diǎn)陽(yáng)光值,不具備攻擊力。(2)碗豆射手。種植需陽(yáng)光值100,作用:5s發(fā)射一顆炮彈,戰(zhàn)斗值1。(3)寒冰射手。種植需陽(yáng)光值175,作用:5s發(fā)射一顆炮彈,戰(zhàn)斗值1.(4)土豆衛(wèi)士。種植需陽(yáng)光值50,作用:抵擋各種僵尸3s,主要用來(lái)防御,沒有任何戰(zhàn)斗力。等共5種可供選擇種植的植物。關(guān)卡簡(jiǎn)介:所有的僵尸都會(huì)參與攻擊,所有的植物也都會(huì)參與作戰(zhàn),每次只能選取5種植物參與作戰(zhàn)。5碰撞邏輯說明僵尸會(huì)在屏幕的右邊生成,然后緩慢向左邊屏幕移動(dòng),如果在僵尸移動(dòng)的線路上有攻擊型植物,則發(fā)射炮彈。當(dāng)種植的植物或炮彈與僵尸接觸,即當(dāng)他們的坐標(biāo)相同的時(shí)候,即為接觸,接觸大小的區(qū)域就是圖片的大小區(qū)域。當(dāng)炮彈與僵尸碰撞之后,炮彈也就會(huì)立即消失,同時(shí)僵尸生命值的也隨之減少一點(diǎn)。若炮彈未擊中任何僵尸,越出屏幕后也將消失。2.技術(shù)分工本人在項(xiàng)目中負(fù)責(zé)后臺(tái)代碼實(shí)現(xiàn),主要有陽(yáng)光添加僵尸移動(dòng)子彈移動(dòng)生產(chǎn)陽(yáng)光產(chǎn)生子彈3.設(shè)計(jì)方法通過玩家對(duì)不同植物的選擇,例如向日葵可快速產(chǎn)生陽(yáng)光,豌豆射手可攻擊敵人等等,來(lái)操作游戲,后臺(tái)通過調(diào)整時(shí)間和參數(shù)達(dá)到前端界面游戲的可玩性。功能類別子功能前端游戲界面主界面模式選擇進(jìn)入游戲確定關(guān)卡退出后臺(tái)代碼設(shè)計(jì)選擇、放置植物陽(yáng)光生產(chǎn)時(shí)間收集陽(yáng)光產(chǎn)生僵尸攻擊、殺死僵尸技術(shù)要求:前端:Javascript后臺(tái):Servlet 開發(fā)工具:MyEclipse因?yàn)轭愔幸呀?jīng)寫好了方法和屬性,在后臺(tái)代碼設(shè)計(jì)中,只需要調(diào)用之前寫好的類,對(duì)靜止的圖像進(jìn)行多次重繪,就可以實(shí)現(xiàn)游戲的畫面。
第三部分成果展示設(shè)計(jì)成果:產(chǎn)品設(shè)計(jì)類一:運(yùn)行截圖 二:程序代碼:陽(yáng)光添加代碼:packageplantvsplant.tool;importjava.awt.event.MouseAdapter;importjava.awt.event.MouseEvent;importjavax.swing.JLabel;importplantvsplant.Controller;publicclassSunAddextendsThread{ Controllercontroller; privateJLabelsun; privateinta; privateintb; publicstaticbooleanstop=false; publicSunAdd(intx,inty,Controllercontroller,JLabelsun){ this.controller=controller; this.a=x; this.b=y; this.sun=sun; } publicvoidrun(){ sun.addMouseListener(newMouseAdapter(){ publicvoidmouseClicked(MouseEvente){ sun.setVisible(false); controller.putSunValue(25); } }); while(true){ if(stop){ sun.setVisible(false); break; } try{ sleep(200); }catch(InterruptedExceptione){ e.printStackTrace(); } b+=3; if(a<200) a+=2; sun.setBounds(a,b,80,80); if(b>=650) { sun.setVisible(false); break; } } }}僵尸移動(dòng)代碼:packageplantvsplant.tool;importjavax.swing.JLabel;importplantvsplant.Controller;publicclassCorpseMoveThreadextendsThread{ privateintx; privateinty; privateJLabelcorpse; privatebooleanflag=true; privateintsecond=1500; privateControllercontroller; publicCorpseMoveThread(Controllercontroller,intx,inty){ this.x=x; this.y=y; this.controller=controller; controller.getWin().putCorpse(x,y,Integer.parseInt(controller.getGrid().getBoard()[x][y].substring(0,2))); corpse=controller.getWin().getCorpseMap().get(100*x+y); } publicvoidrun(){ while(flag){ intaa=controller.moveCorpse(x,y); corpse.setVisible(false); if(aa==-1){ flag=false; }else{ controller.getWin().putCorpse(x,aa,Integer.parseInt(controller.getGrid().getBoard()[x][aa].substring(0,2))); corpse=controller.getWin().getCorpseMap().get(100*x+aa); y=aa; } try{ sleep(second); }catch(Exceptione){ } } if(flag==false){ corpse.setVisible(false); } } publicintgetX(){ returnx; } publicvoidsetX(intx){ this.x=x; } publicintgetY(){ returny; } publicvoidsetY(inty){ this.y=y; } publicbooleanisFlag(){ returnflag; } publicvoidsetFlag(booleanflag){ this.flag=flag; } publicintgetSecond(){ returnsecond; } publicvoidsetSecond(intsecond){ this.second=second; } publicControllergetController(){ returncontroller; } publicvoidsetController(Controllercontroller){ this.controller=controller; } publicJLabelgetCorpse(){ returncorpse; } publicvoidsetCorpse(JLabelcorpse){ this.corpse=corpse; } }子彈移動(dòng)代碼:packageplantvsplant.tool;importjavax.swing.JLabel;importplantvsplant.Controller;publicclassCorpseMoveThreadextendsThread{ privateintx; privateinty; privateJLabelcorpse; privatebooleanflag=true; privateintsecond=1500; privateControllercontroller; publicCorpseMoveThread(Controllercontroller,intx,inty){ this.x=x; this.y=y; this.controller=controller; controller.getWin().putCorpse(x,y,Integer.parseInt(controller.getGrid().getBoard()[x][y].substring(0,2))); corpse=controller.getWin().getCorpseMap().get(100*x+y); } publicvoidrun(){ while(flag){ intaa=controller.moveCorpse(x,y); corpse.setVisible(false); if(aa==-1){ flag=false; }else{ controller.getWin().putCorpse(x,aa,Integer.parseInt(controller.getGrid().getBoard()[x][aa].substring(0,2))); corpse=controller.getWin().getCorpseMap().get(100*x+aa); y=aa; } try{ sleep(second); }catch(Exceptione){ } } if(flag==false){ corpse.setVisible(false); } } publicintgetX(){ returnx; } publicvoidsetX(intx){ this.x=x; } publicintgetY(){ returny; } publicvoidsetY(inty){ this.y=y; } publicbooleanisFlag(){ returnflag; } publicvoidsetFlag(booleanflag){ this.flag=flag; } publicintgetSecond(){ returnsecond; } publicvoidsetSecond(intsecond){ this.second=second; } publicControllergetController(){ returncontroller; } publicvoidsetController(Controllercontroller){ this.controller=controller; } publicJLabelgetCorpse(){ returncorpse; } publicvoidsetCorpse(JLabelcorpse){ this.corpse=corpse; } }太陽(yáng)花生產(chǎn)陽(yáng)光代碼:packageplantvsplant.tool;importjavax.swing.JLabel;importplantvsplant.Controller;publicclassCorpseMoveThreadextendsThread{ privateintx; privateinty; privateJLabelcorpse; privatebooleanflag=true; privateintsecond=1500; privateControllercontroller; publicCorpseMoveThread(Controllercontroller,intx,inty){ this.x=x; this.y=y; this.controller=controller; controller.getWin().putCorpse(x,y,Integer.parseInt(controller.getGrid().getBoard()[x][y].substring(0,2))); corpse=controller.getWin().getCorpseMap().get(100*x+y); } publicvoidrun(){ while(flag){ intaa=controller.moveCorpse(x,y); corpse.setVisible(false); if(aa==-1){ flag=false; }else{ controller.getWin().putCorpse(x,aa,Integer.parseInt(controller.getGrid().getBoard()[x][aa].substring(0,2))); corpse=controller.getWin().getCorpseMap().get(100*x+aa); y=aa; } try{ sleep(second); }catch(Exceptione){ } } if(flag==false){ corpse.setVisible(false); } } publicintgetX(){ returnx; } publicvoidsetX(intx){ this.x=x; } publicintgetY(){ returny; } publicvoidsetY(inty){ this.y=y; } publicbooleanisFlag(){ returnflag; } publicvoidsetFlag(booleanflag){ this.flag=flag; } publicintgetSecond(){ returnsecond; } publicvoidsetSecond(intsecond){ this.second=second; } publicControllergetController(){ returncontroller; } publicvoidsetController(Controllercontroller){ this.controller=controller; } publicJLabelgetCorpse(){ returncorpse; } publicvoidsetCorpse(JLabelcorpse){ this.corpse=corpse; } }子彈生產(chǎn)代碼:packageplantvsplant.tool;importplantvsplant.Controller;publicclassProduceBulletextendsThread{ privatebooleanflag=true; privateintx; privateinty; privateControllercontroller; publicProduceBullet(intx,Controllercontroller,inty){ this.controller=controller; this.x=x; this.y=y; } publicvoidrun(){ while(flag){ duceBullet(x,y); controller.isStopProduceButtle(x,y); try{ sleep(1500); }catch(Exceptione){ e.printStackTrace(); } } } publicbooleanisFlag(){ returnflag; } publicvoidsetFlag(booleanflag){ this.flag=flag; }}
第四部分結(jié)束語(yǔ)在這一個(gè)月的畢業(yè)設(shè)計(jì)中,考驗(yàn)了我是否真的牢固掌握了全部所學(xué)的專業(yè)知識(shí),通過本次畢業(yè)設(shè)計(jì),我深深感覺到基礎(chǔ)知識(shí)的不健全和不牢固,在本次畢業(yè)設(shè)計(jì)中表現(xiàn)出了這樣或那樣的不足和漏洞,說明了基本功的不扎實(shí),所幸我得到了老師和同學(xué)們的熱情幫助,使這些問題得到了解決,這將對(duì)我以后的工作和學(xué)習(xí)有極大的幫助。再者,本次畢業(yè)設(shè)計(jì)全面鍛煉了我駕御知識(shí)的能力,使我對(duì)這三年來(lái)所學(xué)的理論知識(shí)進(jìn)行了系統(tǒng)化、條理化、全面化的回顧和復(fù)習(xí)讓我懂得了如何運(yùn)用自己所學(xué)的知識(shí),同時(shí)又學(xué)到了獵取其他知識(shí)的方法,這些都將作為課本知識(shí)的有益補(bǔ)充,為我們以后所要從事的工作打下堅(jiān)實(shí)的基礎(chǔ)。由于此次畢業(yè)設(shè)計(jì)的角度限制和知識(shí)的不夠系統(tǒng)和不夠完善,難免有錯(cuò)誤和不足之處敬請(qǐng)老師批評(píng)指正以完善此次畢業(yè)設(shè)計(jì)。本次畢業(yè)設(shè)計(jì)已經(jīng)結(jié)束,我不僅收獲了知識(shí)而且也鍛煉了品質(zhì),通過這次認(rèn)真而又細(xì)致的畢業(yè)設(shè)
溫馨提示
- 1. 本站所有資源如無(wú)特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 行政事業(yè)單位新財(cái)務(wù)制度
- 茶業(yè)合作社財(cái)務(wù)制度管理
- 農(nóng)業(yè)站財(cái)務(wù)制度
- 市科協(xié)財(cái)務(wù)制度
- 國(guó)稅網(wǎng)填會(huì)計(jì)財(cái)務(wù)制度
- 衛(wèi)生院內(nèi)控財(cái)務(wù)制度
- 養(yǎng)老院老人健康監(jiān)測(cè)人員激勵(lì)制度
- 潮州膳食管理制度細(xì)則(3篇)
- 刷白的施工方案(3篇)
- ab樁施工方案(3篇)
- QGDW10384-2023輸電線路鋼管塔加工技術(shù)規(guī)程
- 《養(yǎng)老機(jī)構(gòu)智慧運(yùn)營(yíng)與管理》全套教學(xué)課件
- 2025年本科院校圖書館招聘面試題
- 電子商務(wù)畢業(yè)論文5000
- 2025-2026學(xué)年人教版(2024)初中生物八年級(jí)上冊(cè)教學(xué)計(jì)劃及進(jìn)度表
- 醫(yī)療衛(wèi)生輿情課件模板
- 高壓注漿施工方案(3篇)
- 高強(qiáng)混凝土知識(shí)培訓(xùn)課件
- (高清版)DB11∕T 1455-2025 電動(dòng)汽車充電基礎(chǔ)設(shè)施規(guī)劃設(shè)計(jì)標(biāo)準(zhǔn)
- 暖通工程施工環(huán)保措施
- 宗族團(tuán)年活動(dòng)方案
評(píng)論
0/150
提交評(píng)論