看了官方的横版格斗游戏,我从我们的实际项目中,也抽出一个实用的教程,讲述做一个可以上线可玩的横版格斗游戏。
首先进入QUICK的工作目录夹,我是安装在c盘的work目录下的,quick-cocos2d-x下,然后再进入bin目录,然后执行:
注意:这里教程是用quick 2.25 plus版本,因为我要用到里面的dragonbone骨骼动画,做格斗和特效动画。
C:\work\quick-cocos2d-x\bin>create_project -p com.cocos2dlua.fight -r landscape
屏幕会出现:
config:
package = "com.cocos2dlua.fight"
output = "C:\work\quick-cocos2d-x\bin\fight\"
orientation = "landscape"
template = "C:\work\quick-cocos2d-x\bin\..\template\PROJECT_TEMPLATE_01\"
create file "proj.android\AndroidManifest.xml" ... OK
create file "proj.android\build_native.bat" ... OK
create file "proj.android\build_native.sh" ... OK
create file "proj.android\clean.bat" ... OK
create file "proj.android\clean.sh" ... OK
create file "proj.android\jni\Android.mk" ... OK
create file "proj.android\jni\Application.mk" ... OK
create file "proj.android\jni\hellocpp\main.cpp" ... OK
create file "proj.android\jni\list.sh" ... OK
create file "proj.android\project.properties" ... OK
create file "proj.android\res\drawable-hdpi\icon.png" ... OK
create file "proj.android\res\drawable-ldpi\icon.png" ... OK
create file "proj.android\res\drawable-mdpi\icon.png" ... OK
create file "proj.android\res\values\strings.xml" ... OK
create file "proj.android\src\com\cocos2dlua\fight\Fight.java" ... OK
create file "proj.ios\AppController.h" ... OK
create file "proj.ios\AppController.mm" ... OK
create file "proj.ios\main.m" ... OK
create file "proj.ios\Prefix.pch" ... OK
create file "proj.ios\Resources\Default-568h@2x.png" ... OK
create file "proj.ios\Resources\Default.png" ... OK
create file "proj.ios\Resources\Default@2x.png" ... OK
create file "proj.ios\Resources\Icon-72.png" ... OK
create file "proj.ios\Resources\Icon.png" ... OK
create file "proj.ios\Resources\Icon@2x.png" ... OK
create file "proj.ios\Resources\Info.plist" ... OK
create file "proj.ios\RootViewController.h" ... OK
create file "proj.ios\RootViewController.mm" ... OK
create file "proj.ios\fight.xcodeproj\project.pbxproj" ... OK
create file "proj.mac\AppController.h" ... OK
create file "proj.mac\AppController.mm" ... OK
create file "proj.mac\Icon.icns" ... OK
create file "proj.mac\Info.plist" ... OK
create file "proj.mac\main.m" ... OK
create file "proj.mac\MainMenu.xib" ... OK
create file "proj.mac\Prefix.pch" ... OK
create file "proj.mac\fight.xcodeproj\project.pbxproj" ... OK
create file "proj.win32\app.cpp" ... OK
create file "proj.win32\app.h" ... OK
create file "proj.win32\app.ico" ... OK
create file "proj.win32\app.rc" ... OK
create file "proj.win32\resource.h" ... OK
create file "proj.win32\stdafx.cpp" ... OK
create file "proj.win32\stdafx.h" ... OK
create file "proj.win32\targetver.h" ... OK
create file "proj.win32\fight.sln" ... OK
create file "proj.win32\fight.vcxproj" ... OK
create file "proj.win32\fight.vcxproj.filters" ... OK
create file "res\framework_precompiled.zip" ... OK
create file "run-mac.sh" ... OK
create file "scripts\app\MyApp.lua" ... OK
create file "scripts\app\scenes\MainScene.lua" ... OK
create file "scripts\config.lua" ... OK
create file "scripts\main.lua" ... OK
create file "sources\AppDelegate.cpp" ... OK
create file "sources\AppDelegate.h" ... OK
--------------
其实上面的提示就告诉我们,这个bat执行了两件事情:
1)在bin目录下,创建了一个fight工作目录,然后以bin同级的template目录下的PROJECT_TEMPLATE_01目录为模版,在fight目录创建文件。
2)依次创建:
- proj.android,proj.ios,proj.mac,proj.win32 4个不同系统所需要的子目录,其他的:
- res子目录是放4个系统都会用到的资源目录,scripts是放4个系统都会用到的脚本目录,sources目录是AppDelegate.cpp和AppDelegate.h,就理解为c程序的main的入口函数,因为已经封装好了,暂时不用管他,但是我们在后面脚本加密中,会用到这个目录,因为默认的脚本是没有加密的,所以不用管这个目录。
- run-mac.sh是苹果系统编译时需要用的,暂时不管。
- TEMPLATE_INFO.json,打开文件,内容就只有一个:{"name": "PROJECT_TEMPLATE_01"},就是模版的信息