摘要:該文介紹了一款2D手機(jī)游戲軟件的開發(fā)過程,該軟件使用Cocos2d-Android-1作為引擎,設(shè)計(jì)了植物精靈、僵尸精靈、子彈精靈等精靈類及背景層、精靈層。游戲軟件的業(yè)務(wù)邏輯并不復(fù)雜,只設(shè)計(jì)了第一關(guān)卡。游戲的碰撞檢測根據(jù)不同要求采用不同的邏輯思想,各精靈也產(chǎn)生在不同的圖層上,從而增加了游戲的效果。整個(gè)游戲匹配了相應(yīng)的音效。
關(guān)鍵詞:Cocos2d;導(dǎo)演類;精靈類
中圖分類號(hào):TP37 文獻(xiàn)標(biāo)識(shí)碼:A 文章編號(hào):1009-3044(2014)20-4827-02
The Development of Mobile Phone Game Based on Cocos2d-android
PENG Shou-zhen 1 , ZHAN Fa-rong 2
(1Zhaoqing Science and Technology Polytechnic, Guangdong Zhaoqing; 2 Zhaoqing Fenghua Lithium Battery Co Ltd Guangdong Zhaoqing)
Abstract: This paper introduces the development process of a 2D mobile phone game software, the software uses the Cocos2d-Android-1 as the engine, designed the elves, elves, plant zombie bullet fairy elf and elves background layer, layer. The business logic of the game software is not complicated, just design the first checkpoint. Collision detection game using logic according to different requirements, the elves also produced in different layers, thereby increasing the effect of the game. The game matched the corresponding sound.
Key words: Cocos2d; director; the wizard class
目前,市場上手機(jī)游戲軟件琳瑯滿目,開發(fā)工具和方法多種多樣,這類的游戲軟件大多數(shù)是基于C++和java的,有的不用引擎,但不用引擎做游戲開發(fā)周期長,工作復(fù)雜。使用引擎開發(fā)手機(jī)游戲能夠節(jié)省大量的開發(fā)工作和時(shí)間,提高開發(fā)效率。當(dāng)前互聯(lián)網(wǎng)上游戲引擎為數(shù)較多,有免費(fèi)引擎和商業(yè)引擎之分,這其中又有2D和3D之分。該文介紹的是使用Cocos2d作為引擎、基于android系統(tǒng)的一款2D手機(jī)游戲軟件。關(guān)于Cocos2d引擎的版本較多,互聯(lián)網(wǎng)上使用該類引擎的版本大多數(shù)是Cocos2d-X,而Cocos2d-android-1版本使用較少,相關(guān)參考資料也較少,該文介紹的游戲軟件正是基于Cocos2d-android-1版本開發(fā)的。本人在開發(fā)過程中借鑒了互聯(lián)網(wǎng)上“植物大戰(zhàn)僵尸”這款游戲的相關(guān)圖片資源,不作為商業(yè)用途。
1 引擎介紹及開發(fā)環(huán)境
1) Cocos2d-android-1版本是Cocos2d引擎的一個(gè)子分支,它在Cocos2d家庭中的位置如圖1所示:
2) 在Eclipse中引入引擎。首先在網(wǎng)站http://code.google.com/p/cocos2d-android-1/downloads/list下載引擎包:cocos2d-android.jar其次將該引擎包導(dǎo)入到eclipse中l(wèi)ib目錄中,導(dǎo)入方法是在新建的游戲項(xiàng)目中將該包拷貝到lib文件夾下即可[1]。
3) 開發(fā)工具的使用。……