走迷宮游戲程序設(shè)計(jì)

走迷宮游戲程序設(shè)計(jì)

ID:13003655

大?。?23.00 KB

頁(yè)數(shù):33頁(yè)

時(shí)間:2018-07-20

走迷宮游戲程序設(shè)計(jì)_第1頁(yè)
走迷宮游戲程序設(shè)計(jì)_第2頁(yè)
走迷宮游戲程序設(shè)計(jì)_第3頁(yè)
走迷宮游戲程序設(shè)計(jì)_第4頁(yè)
走迷宮游戲程序設(shè)計(jì)_第5頁(yè)
資源描述:

《走迷宮游戲程序設(shè)計(jì)》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在學(xué)術(shù)論文-天天文庫(kù)。

1、一、題目(問(wèn)題)描述模擬網(wǎng)絡(luò)中的走迷宮游戲,如圖1:圖1迷宮地圖-33-二、功能分析通過(guò)體驗(yàn)并分析后得出走迷宮游戲中主要功能包括:1.初始化新游戲的開(kāi)局功能。2.尋路功能3.小人前后左右移動(dòng)。-33-三、系統(tǒng)設(shè)計(jì)1.程序總體結(jié)構(gòu)程序中由主模塊負(fù)責(zé)協(xié)調(diào)各功能模塊的工作。開(kāi)局后,根據(jù)輸入操作,執(zhí)行小人的前后左右移動(dòng)和尋路功能,并同時(shí)在屏幕輸出。如圖2:走迷宮程序系統(tǒng)開(kāi)局輸入小人移動(dòng)小人尋路輸出圖2走迷宮的總體結(jié)構(gòu)圖2.界面設(shè)計(jì)如圖3,代表墻壁;代表道路;代表目的地;代表小人;-33-3.輸入方式設(shè)計(jì)此游戲?yàn)閐os下程序,因此簡(jiǎn)化為鍵盤(pán)控制。w,s,a,d,鍵用來(lái)移動(dòng)小人的位置。如

2、圖3:圖3程序化迷宮圖4.重要數(shù)據(jù)的數(shù)據(jù)結(jié)構(gòu)設(shè)計(jì)圖形界面數(shù)據(jù)intmap[25][25]={{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},{1,6,1,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1},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1,0,0,0,0,0,1},{1,0,1,1,1,1,1,0,1,0,1,0,1,0,1,1,1,0,1,1,1,1,1,1,1},{1,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,4,3,1},{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},};-33-};/*定義一個(gè)二維數(shù)組,其中的元素是不同圖像的ID號(hào),空地為0,墻壁為1,,目的地為3,人為6.*/5.函數(shù)設(shè)計(jì)文件中函數(shù)的功能如下:文件名函數(shù)原型函數(shù)功能函數(shù)處理描述走迷宮.Cchari

7、nput無(wú)需回車(chē)確認(rèn)地獲取用戶輸入,用于控制行走方向w,s,a,d來(lái)控制小人上下左右移動(dòng)voiddraw_map繪圖功能定義一個(gè)二維數(shù)組,不同ID號(hào)代表不同的圖像元素voidResult(void)輸出結(jié)果處理處理走迷宮的結(jié)果voidFind(void)成功處理走迷宮成功后的處理-33-voidNotFind(void)失敗處理走迷宮失敗后的處理四、關(guān)鍵技術(shù)、難點(diǎn)及其解決方法此程序的關(guān)鍵是判斷數(shù)組的ID號(hào),保證游戲可以正常運(yùn)行并且闖關(guān)成功。解決方法:根據(jù)在紙面上設(shè)計(jì)好的游戲圖形界面,分析在二維數(shù)組里所對(duì)

當(dāng)前文檔最多預(yù)覽五頁(yè),下載文檔查看全文

此文檔下載收益歸作者所有

當(dāng)前文檔最多預(yù)覽五頁(yè),下載文檔查看全文
溫馨提示:
1. 部分包含數(shù)學(xué)公式或PPT動(dòng)畫(huà)的文件,查看預(yù)覽時(shí)可能會(huì)顯示錯(cuò)亂或異常,文件下載后無(wú)此問(wèn)題,請(qǐng)放心下載。
2. 本文檔由用戶上傳,版權(quán)歸屬用戶,天天文庫(kù)負(fù)責(zé)整理代發(fā)布。如果您對(duì)本文檔版權(quán)有爭(zhēng)議請(qǐng)及時(shí)聯(lián)系客服。
3. 下載前請(qǐng)仔細(xì)閱讀文檔內(nèi)容,確認(rèn)文檔內(nèi)容符合您的需求后進(jìn)行下載,若出現(xiàn)內(nèi)容與標(biāo)題不符可向本站投訴處理。
4. 下載文檔時(shí)可能由于網(wǎng)絡(luò)波動(dòng)等原因無(wú)法下載或下載錯(cuò)誤,付費(fèi)完成后未能成功下載的用戶請(qǐng)聯(lián)系客服處理。