diff --git a/games/MoonWarriors-Runtime/boot-html5.js b/games/MoonWarriors-Runtime/boot-html5.js
new file mode 100755
index 00000000..b1648fa3
--- /dev/null
+++ b/games/MoonWarriors-Runtime/boot-html5.js
@@ -0,0 +1,95 @@
+/****************************************************************************
+ Copyright (c) 2010-2012 cocos2d-x.org
+
+ http://www.cocos2d-x.org
+
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ ****************************************************************************/
+
+// boot code needed for cocos2d-html5
+// Not needed by cocos2d + JS bindings
+
+(function () {
+ var d = document;
+ var c = {
+ COCOS2D_DEBUG: 2, //0 to turn debug off, 1 for basic debug, and 2 for full debug
+ showFPS: true,
+ loadExtension: true,
+ frameRate: 60,
+ renderMode: 1, //Choose of RenderMode: 0(default), 1(Canvas only), 2(WebGL only)
+ tag: 'gameCanvas', //the dom element to run cocos2d on
+ engineDir: '../../../cocos2d/',
+ //SingleEngineFile:'game.min.js',
+ appFiles: [
+ 'src/Resource.js',
+ 'src/config/GameConfig.js',
+ 'src/config/EnemyType.js',
+ 'src/config/Level.js',
+ 'src/Effect.js',
+ 'src/Bullet.js',
+ 'src/Enemy.js',
+ 'src/Explosion.js',
+ 'src/Ship.js',
+ 'src/LevelManager.js',
+ 'src/GameController.js',
+ 'src/GameControlMenu.js',
+ 'src/GameLayer.js',
+ 'src/GameOver.js',
+ 'src/AboutLayer.js',
+ 'src/SettingsLayer.js',
+ 'src/SysMenu.js',
+ 'src/HitEffect.js',
+ 'src/SparkEffect.js',
+ 'src/Background.js'
+ ]
+ };
+
+ if (!d.createElement('canvas').getContext) {
+ var s = d.createElement('div');
+ s.innerHTML = '
Your browser does not support HTML5 canvas!
' +
+ 'Google Chrome is a browser that combines a minimal design with sophisticated technology to make the web faster, safer, and easier.Click the logo to download.
' +
+ '
';
+ var p = d.getElementById(c.tag).parentNode;
+ p.insertBefore(s);
+ return;
+ }
+
+
+ //first load engine file if specified
+ var s = d.createElement('script');
+ /*********Delete this section if you have packed all files into one*******/
+ if (c.SingleEngineFile && !c.engineDir) {
+ s.src = c.SingleEngineFile;
+ }
+ else if (c.engineDir && !c.SingleEngineFile) {
+ s.src = c.engineDir + 'jsloader.js';
+ }
+ else {
+ alert('You must specify either the single engine file OR the engine directory in "cocos2d.js"');
+ }
+ /*********Delete this section if you have packed all files into one*******/
+
+ //s.src = 'Packed_Release_File.js'; //IMPORTANT: Un-comment this line if you have packed all files into one
+
+ d.body.appendChild(s);
+ document.ccConfig = c;
+ s.id = 'cocos2d-html5';
+ //else if single file specified, load singlefile
+})();
diff --git a/games/MoonWarriors-Runtime/boot-jsb.js b/games/MoonWarriors-Runtime/boot-jsb.js
new file mode 100755
index 00000000..b7caed50
--- /dev/null
+++ b/games/MoonWarriors-Runtime/boot-jsb.js
@@ -0,0 +1,73 @@
+/****************************************************************************
+ Copyright (c) 2010-2012 cocos2d-x.org
+
+ http://www.cocos2d-x.org
+
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ ****************************************************************************/
+
+// boot code needed for cocos2d + JS bindings.
+// Not needed by cocos2d-html5
+
+require("script/jsb.js");
+
+var MW = MW || {};
+
+var appFiles = [
+ 'src/Resource.js',
+ 'src/config/GameConfig.js',
+ 'src/config/EnemyType.js',
+ 'src/config/Level.js',
+ 'src/Effect.js',
+ 'src/Bullet.js',
+ 'src/Enemy.js',
+ 'src/Explosion.js',
+ 'src/Ship.js',
+ 'src/LevelManager.js',
+ 'src/GameController.js',
+ 'src/GameControlMenu.js',
+ 'src/GameLayer.js',
+ 'src/GameOver.js',
+ 'src/AboutLayer.js',
+ 'src/SettingsLayer.js',
+ 'src/SysMenu.js',
+ 'src/SparkEffect.js',
+ 'src/HitEffect.js',
+ 'src/Background.js'
+];
+
+cc.dumpConfig();
+
+for( var i=0; i < appFiles.length; i++) {
+ require( appFiles[i] );
+}
+
+var director = cc.Director.getInstance();
+director.setDisplayStats(true);
+
+// set FPS. the default value is 1.0/60 if you don't call this
+director.setAnimationInterval(1.0 / 60);
+
+// create a scene. it's an autorelease object
+var mainScene = SysMenu.scene();
+
+// run
+director.runWithScene(mainScene);
+
diff --git a/games/MoonWarriors-Runtime/build.xml b/games/MoonWarriors-Runtime/build.xml
new file mode 100755
index 00000000..cc225329
--- /dev/null
+++ b/games/MoonWarriors-Runtime/build.xml
@@ -0,0 +1,155 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/games/MoonWarriors-Runtime/config.json b/games/MoonWarriors-Runtime/config.json
new file mode 100644
index 00000000..db8ad75c
--- /dev/null
+++ b/games/MoonWarriors-Runtime/config.json
@@ -0,0 +1,19 @@
+{
+ "game_name": "月亮战士v2",
+ "package_name": "org.cocos2dx.moonwarriors.v2",
+ "version_name": "1.0.2",
+ "version_code": 2,
+ "runtime_version": "2.2.6.4",
+ "description": "这是灰常好玩的打飞机游戏!",
+ "orientation": "portrait",
+ "entry_file": "main.js",
+ "game_type": "offline",
+ "design_resolution": {
+ "width": 320,
+ "height": 480,
+ "policy": "SHOW_ALL"
+ },
+ "security": {
+ "password":"moonwarriors"
+ }
+}
diff --git a/games/MoonWarriors-Runtime/group.json b/games/MoonWarriors-Runtime/group.json
new file mode 100644
index 00000000..98f2e837
--- /dev/null
+++ b/games/MoonWarriors-Runtime/group.json
@@ -0,0 +1,93 @@
+{
+ "boot": {
+ "priority": 0,
+ "files": [
+ "res_engine/dialog_bg.png",
+ "res_engine/dialog_cancel_normal.png",
+ "res_engine/dialog_cancel_press.png",
+ "res_engine/dialog_confirm_normal.png",
+ "res_engine/dialog_confirm_press.png",
+ "res_engine/preload_bg.jpg",
+ "res_engine/preload_logo.png",
+ "res_engine/preload_title.png",
+ "res_engine/progress_bar.png",
+ "res_engine/progress_bg.png",
+ "res_engine/progress_light.png",
+ "res_engine/progress_shadow.png",
+ "res/dialog_bg.png",
+ "res/dialog_cancel_normal.png",
+ "res/dialog_cancel_press.png",
+ "res/dialog_confirm_normal.png",
+ "res/dialog_confirm_press.png",
+ "res/flare.jpg",
+ "res/loading.png",
+ "res/logo.png",
+ "res/menu.png",
+ "res/Music/buttonEffet.mp3",
+ "res/Music/buttonEffet.ogg",
+ "res/Music/mainMainMusic.mp3",
+ "res/Music/mainMainMusic.ogg",
+ "res/textureTransparentPack.plist",
+ "res/textureTransparentPack.png",
+ "src/AboutLayer.js",
+ "src/Background.js",
+ "src/Bullet.js",
+ "src/config/EnemyType.js",
+ "src/config/GameConfig.js",
+ "src/config/Level.js",
+ "src/Effect.js",
+ "src/Enemy.js",
+ "src/Explosion.js",
+ "src/GameController.js",
+ "src/GameControlMenu.js",
+ "src/GameLayer.js",
+ "src/GameOver.js",
+ "src/HitEffect.js",
+ "src/LevelManager.js",
+ "src/Resource.js",
+ "src/SettingsLayer.js",
+ "src/Ship.js",
+ "src/SparkEffect.js",
+ "src/SysMenu.js"
+ ]
+ },
+
+ "common": {
+ "priority": 1,
+ "files": [
+ "res/menuTitle.png"
+ ]
+ },
+
+ "gamelayer": {
+ "priority": 2,
+ "files": [
+ "res/arial-14.fnt",
+ "res/arial-14.png",
+ "res/b01.plist",
+ "res/b01.png",
+ "res/explode.plist",
+ "res/explosion.plist",
+ "res/explosion.png",
+ "res/level01.tmx",
+ "res/Music/bgMusic.mp3",
+ "res/Music/bgMusic.ogg",
+ "res/Music/explodeEffect.mp3",
+ "res/Music/explodeEffect.ogg",
+ "res/Music/fireEffect.mp3",
+ "res/Music/fireEffect.ogg",
+ "res/Music/shipDestroyEffect.mp3",
+ "res/Music/shipDestroyEffect.ogg",
+ "res/textureOpaquePack.plist",
+ "res/textureOpaquePack.png"
+ ]
+ },
+
+ "gameover": {
+ "priority": 3,
+ "files": [
+ "res/cocos2d-html5.png",
+ "res/gameOver.png"
+ ]
+ }
+}
diff --git a/games/MoonWarriors-Runtime/index.html b/games/MoonWarriors-Runtime/index.html
new file mode 100755
index 00000000..6cd9bb7e
--- /dev/null
+++ b/games/MoonWarriors-Runtime/index.html
@@ -0,0 +1,37 @@
+
+
+
+ Cocos2d-html5 Show Case - MoonWarriors
+
+
+
+
+
+
+
+
+
diff --git a/games/MoonWarriors-Runtime/main.js b/games/MoonWarriors-Runtime/main.js
new file mode 100755
index 00000000..c7533b2b
--- /dev/null
+++ b/games/MoonWarriors-Runtime/main.js
@@ -0,0 +1,163 @@
+/****************************************************************************
+ Copyright (c) 2010-2012 cocos2d-x.org
+ Copyright (c) 2008-2010 Ricardo Quesada
+ Copyright (c) 2011 Zynga Inc.
+
+ http://www.cocos2d-x.org
+
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ ****************************************************************************/
+
+var cocos2dApp = cc.Application.extend({
+ config:document['ccConfig'],
+ ctor:function (scene) {
+ this._super();
+ this.startScene = scene;
+ cc.COCOS2D_DEBUG = this.config.COCOS2D_DEBUG;
+ cc.setup(this.config['tag']);
+ cc.AppController.shareAppController().didFinishLaunchingWithOptions();
+ },
+ applicationDidFinishLaunching:function () {
+ // initialize director
+ var director = cc.Director.getInstance();
+
+ cc.EGLView.getInstance().adjustViewPort(true);
+ cc.EGLView.getInstance().setDesignResolutionSize(320,480,cc.RESOLUTION_POLICY.SHOW_ALL);
+ cc.EGLView.getInstance().resizeWithBrowserSize(true);
+
+ // turn on display FPS
+ director.setDisplayStats(this.config['showFPS']);
+
+ // set FPS. the default value is 1.0/60 if you don't call this
+ director.setAnimationInterval(1.0 / this.config['frameRate']);
+
+ //load resources
+ cc.LoaderScene.preload(window["preloadPage"], function () {
+ cc.LoaderLayer.preload(["boot"], function (isSuccess) {
+ director.replaceScene(new this.startScene());
+ },this);
+ }, this);
+
+ return true;
+ }
+});
+
+var myApp = new cocos2dApp(SysMenu.scene);
+
+var AnchorPointCenter = new cc.Point(0.5, 0.5);
+var AnchorPointTop = new cc.Point(0.5, 1);
+var AnchorPointTopRight = new cc.Point(1, 1);
+var AnchorPointRight = new cc.Point(1, 0.5);
+var AnchorPointBottomRight = new cc.Point(1, 0);
+var AnchorPointBottom = new cc.Point(0.5, 0);
+var AnchorPointBottomLeft = new cc.Point(0, 0);
+var AnchorPointLeft = new cc.Point(0, 0.5);
+var AnchorPointTopLeft = new cc.Point(0, 1);
+
+var s_rcVisible = cc.RectZero();
+var s_ptCenter = cc.PointZero();
+var s_ptTop = cc.PointZero();
+var s_ptTopRight = cc.PointZero();
+var s_ptRight = cc.PointZero();
+var s_ptBottomRight = cc.PointZero();
+var s_ptBottom = cc.PointZero();
+var s_ptLeft = cc.PointZero();
+var s_ptTopLeft = cc.PointZero();
+var s_ptBottomLeft = cc.PointZero();
+
+var VisibleRect = {
+ rect:function () {
+ if (s_rcVisible.width == 0) {
+ var s = cc.Director.getInstance().getWinSize();
+ s_rcVisible = cc.rect(0, 0, s.width, s.height);
+ }
+ return s_rcVisible;
+ },
+ center:function () {
+ if (s_ptCenter.x == 0) {
+ var rc = this.rect();
+ s_ptCenter.x = rc.x + rc.width / 2;
+ s_ptCenter.y = rc.y + rc.height / 2;
+ }
+ return s_ptCenter;
+ },
+ top:function () {
+ if (s_ptTop.x == 0) {
+ var rc = this.rect();
+ s_ptTop.x = rc.x + rc.width / 2;
+ s_ptTop.y = rc.y + rc.height;
+ }
+ return s_ptTop;
+ },
+ topRight:function () {
+ if (s_ptTopRight.x == 0) {
+ var rc = this.rect();
+ s_ptTopRight.x = rc.x + rc.width;
+ s_ptTopRight.y = rc.y + rc.height;
+ }
+ return s_ptTopRight;
+ },
+ right:function () {
+ if (s_ptRight.x == 0) {
+ var rc = this.rect();
+ s_ptRight.x = rc.x + rc.width;
+ s_ptRight.y = rc.y + rc.height / 2;
+ }
+ return s_ptRight;
+ },
+ bottomRight:function () {
+ if (s_ptBottomRight.x == 0) {
+ var rc = this.rect();
+ s_ptBottomRight.x = rc.x + rc.width;
+ s_ptBottomRight.y = rc.y;
+ }
+ return s_ptBottomRight;
+ },
+ bottom:function () {
+ if (s_ptBottom.x == 0) {
+ var rc = this.rect();
+ s_ptBottom.x = rc.x + rc.width / 2;
+ s_ptBottom.y = rc.y;
+ }
+ return s_ptBottom;
+ },
+ bottomLeft:function () {
+ return s_ptBottomLeft;
+ },
+ left:function () {
+ if (s_ptLeft.x == 0) {
+ var rc = this.rect();
+ s_ptLeft.x = rc.x;
+ s_ptLeft.y = rc.y + rc.height / 2;
+ }
+ return s_ptLeft;
+ },
+ topLeft:function () {
+ if (s_ptTopLeft.x == 0) {
+ var rc = this.rect();
+ s_ptTopLeft.x = rc.x;
+ s_ptTopLeft.y = rc.y + rc.height;
+ }
+ return s_ptTopLeft;
+ }
+};
+
+var screenWidth = VisibleRect.rect().width;
+var screenHeight = VisibleRect.rect().height;
diff --git a/games/MoonWarriors-Runtime/res/Music/bgMusic.mp3 b/games/MoonWarriors-Runtime/res/Music/bgMusic.mp3
new file mode 100755
index 00000000..69923507
Binary files /dev/null and b/games/MoonWarriors-Runtime/res/Music/bgMusic.mp3 differ
diff --git a/games/MoonWarriors-Runtime/res/Music/bgMusic.ogg b/games/MoonWarriors-Runtime/res/Music/bgMusic.ogg
new file mode 100755
index 00000000..71ea9a16
Binary files /dev/null and b/games/MoonWarriors-Runtime/res/Music/bgMusic.ogg differ
diff --git a/games/MoonWarriors-Runtime/res/Music/buttonEffet.mp3 b/games/MoonWarriors-Runtime/res/Music/buttonEffet.mp3
new file mode 100755
index 00000000..1bf32984
Binary files /dev/null and b/games/MoonWarriors-Runtime/res/Music/buttonEffet.mp3 differ
diff --git a/games/MoonWarriors-Runtime/res/Music/buttonEffet.ogg b/games/MoonWarriors-Runtime/res/Music/buttonEffet.ogg
new file mode 100755
index 00000000..e27b7abb
Binary files /dev/null and b/games/MoonWarriors-Runtime/res/Music/buttonEffet.ogg differ
diff --git a/games/MoonWarriors-Runtime/res/Music/explodeEffect.mp3 b/games/MoonWarriors-Runtime/res/Music/explodeEffect.mp3
new file mode 100755
index 00000000..6c48679e
Binary files /dev/null and b/games/MoonWarriors-Runtime/res/Music/explodeEffect.mp3 differ
diff --git a/games/MoonWarriors-Runtime/res/Music/explodeEffect.ogg b/games/MoonWarriors-Runtime/res/Music/explodeEffect.ogg
new file mode 100755
index 00000000..53251d42
Binary files /dev/null and b/games/MoonWarriors-Runtime/res/Music/explodeEffect.ogg differ
diff --git a/games/MoonWarriors-Runtime/res/Music/fireEffect.mp3 b/games/MoonWarriors-Runtime/res/Music/fireEffect.mp3
new file mode 100755
index 00000000..31d140c8
Binary files /dev/null and b/games/MoonWarriors-Runtime/res/Music/fireEffect.mp3 differ
diff --git a/games/MoonWarriors-Runtime/res/Music/fireEffect.ogg b/games/MoonWarriors-Runtime/res/Music/fireEffect.ogg
new file mode 100755
index 00000000..b8a79788
Binary files /dev/null and b/games/MoonWarriors-Runtime/res/Music/fireEffect.ogg differ
diff --git a/games/MoonWarriors-Runtime/res/Music/mainMainMusic.mp3 b/games/MoonWarriors-Runtime/res/Music/mainMainMusic.mp3
new file mode 100755
index 00000000..118e5daf
Binary files /dev/null and b/games/MoonWarriors-Runtime/res/Music/mainMainMusic.mp3 differ
diff --git a/games/MoonWarriors-Runtime/res/Music/mainMainMusic.ogg b/games/MoonWarriors-Runtime/res/Music/mainMainMusic.ogg
new file mode 100755
index 00000000..c2f047dc
Binary files /dev/null and b/games/MoonWarriors-Runtime/res/Music/mainMainMusic.ogg differ
diff --git a/games/MoonWarriors-Runtime/res/Music/shipDestroyEffect.mp3 b/games/MoonWarriors-Runtime/res/Music/shipDestroyEffect.mp3
new file mode 100755
index 00000000..d1886c77
Binary files /dev/null and b/games/MoonWarriors-Runtime/res/Music/shipDestroyEffect.mp3 differ
diff --git a/games/MoonWarriors-Runtime/res/Music/shipDestroyEffect.ogg b/games/MoonWarriors-Runtime/res/Music/shipDestroyEffect.ogg
new file mode 100755
index 00000000..4e60a8b0
Binary files /dev/null and b/games/MoonWarriors-Runtime/res/Music/shipDestroyEffect.ogg differ
diff --git a/games/MoonWarriors-Runtime/res/arial-14.GlyphProject b/games/MoonWarriors-Runtime/res/arial-14.GlyphProject
new file mode 100755
index 00000000..cbac22bf
Binary files /dev/null and b/games/MoonWarriors-Runtime/res/arial-14.GlyphProject differ
diff --git a/games/MoonWarriors-Runtime/res/arial-14.fnt b/games/MoonWarriors-Runtime/res/arial-14.fnt
new file mode 100755
index 00000000..1d16cb10
--- /dev/null
+++ b/games/MoonWarriors-Runtime/res/arial-14.fnt
@@ -0,0 +1,182 @@
+info face="ArialMT" size=14 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=2,2
+common lineHeight=15 base=13 scaleW=256 scaleH=128 pages=1 packed=0
+page id=0 file="arial-14.png"
+chars count=95
+char id=64 x=2 y=2 width=18 height=18 xoffset=-1 yoffset=1 xadvance=14 page=0 chnl=0 letter="@"
+char id=123 x=22 y=2 width=9 height=18 xoffset=-1 yoffset=1 xadvance=5 page=0 chnl=0 letter="{"
+char id=125 x=33 y=2 width=9 height=18 xoffset=-1 yoffset=1 xadvance=5 page=0 chnl=0 letter="}"
+char id=40 x=44 y=2 width=8 height=18 xoffset=-1 yoffset=1 xadvance=5 page=0 chnl=0 letter="("
+char id=41 x=54 y=2 width=8 height=18 xoffset=0 yoffset=1 xadvance=5 page=0 chnl=0 letter=")"
+char id=124 x=64 y=2 width=6 height=18 xoffset=0 yoffset=1 xadvance=4 page=0 chnl=0 letter="|"
+char id=36 x=72 y=2 width=12 height=17 xoffset=-1 yoffset=1 xadvance=8 page=0 chnl=0 letter="$"
+char id=106 x=86 y=2 width=8 height=17 xoffset=-2 yoffset=2 xadvance=3 page=0 chnl=0 letter="j"
+char id=91 x=96 y=2 width=8 height=17 xoffset=-1 yoffset=2 xadvance=4 page=0 chnl=0 letter="["
+char id=93 x=106 y=2 width=7 height=17 xoffset=-1 yoffset=2 xadvance=4 page=0 chnl=0 letter="]"
+char id=37 x=115 y=2 width=16 height=16 xoffset=-1 yoffset=1 xadvance=12 page=0 chnl=0 letter="%"
+char id=81 x=133 y=2 width=15 height=16 xoffset=-1 yoffset=1 xadvance=11 page=0 chnl=0 letter="Q"
+char id=79 x=150 y=2 width=15 height=16 xoffset=-1 yoffset=1 xadvance=11 page=0 chnl=0 letter="O"
+char id=71 x=167 y=2 width=14 height=16 xoffset=-1 yoffset=1 xadvance=11 page=0 chnl=0 letter="G"
+char id=67 x=183 y=2 width=14 height=16 xoffset=-1 yoffset=1 xadvance=10 page=0 chnl=0 letter="C"
+char id=38 x=199 y=2 width=13 height=16 xoffset=-1 yoffset=1 xadvance=9 page=0 chnl=0 letter="&"
+char id=83 x=214 y=2 width=13 height=16 xoffset=-1 yoffset=1 xadvance=9 page=0 chnl=0 letter="S"
+char id=35 x=229 y=2 width=12 height=16 xoffset=-1 yoffset=1 xadvance=8 page=0 chnl=0 letter="#"
+char id=47 x=243 y=2 width=8 height=16 xoffset=-1 yoffset=1 xadvance=4 page=0 chnl=0 letter="/"
+char id=92 x=2 y=22 width=8 height=16 xoffset=-1 yoffset=1 xadvance=4 page=0 chnl=0 letter="\"
+char id=85 x=12 y=22 width=12 height=15 xoffset=0 yoffset=2 xadvance=10 page=0 chnl=0 letter="U"
+char id=51 x=26 y=22 width=12 height=15 xoffset=-1 yoffset=2 xadvance=8 page=0 chnl=0 letter="3"
+char id=53 x=40 y=22 width=12 height=15 xoffset=-1 yoffset=2 xadvance=8 page=0 chnl=0 letter="5"
+char id=54 x=54 y=22 width=12 height=15 xoffset=-1 yoffset=2 xadvance=8 page=0 chnl=0 letter="6"
+char id=56 x=68 y=22 width=12 height=15 xoffset=-1 yoffset=2 xadvance=8 page=0 chnl=0 letter="8"
+char id=57 x=82 y=22 width=12 height=15 xoffset=-1 yoffset=2 xadvance=8 page=0 chnl=0 letter="9"
+char id=48 x=96 y=22 width=12 height=15 xoffset=-1 yoffset=2 xadvance=8 page=0 chnl=0 letter="0"
+char id=63 x=110 y=22 width=12 height=15 xoffset=-1 yoffset=1 xadvance=8 page=0 chnl=0 letter="?"
+char id=98 x=124 y=22 width=12 height=15 xoffset=-1 yoffset=2 xadvance=8 page=0 chnl=0 letter="b"
+char id=112 x=138 y=22 width=12 height=15 xoffset=-1 yoffset=4 xadvance=8 page=0 chnl=0 letter="p"
+char id=121 x=152 y=22 width=11 height=15 xoffset=-1 yoffset=4 xadvance=7 page=0 chnl=0 letter="y"
+char id=103 x=165 y=22 width=11 height=15 xoffset=-1 yoffset=4 xadvance=8 page=0 chnl=0 letter="g"
+char id=100 x=178 y=22 width=11 height=15 xoffset=-1 yoffset=2 xadvance=8 page=0 chnl=0 letter="d"
+char id=113 x=191 y=22 width=11 height=15 xoffset=-1 yoffset=4 xadvance=8 page=0 chnl=0 letter="q"
+char id=74 x=204 y=22 width=10 height=15 xoffset=-1 yoffset=2 xadvance=7 page=0 chnl=0 letter="J"
+char id=102 x=216 y=22 width=9 height=15 xoffset=-1 yoffset=1 xadvance=4 page=0 chnl=0 letter="f"
+char id=116 x=227 y=22 width=8 height=15 xoffset=-1 yoffset=2 xadvance=4 page=0 chnl=0 letter="t"
+char id=87 x=237 y=22 width=17 height=14 xoffset=-1 yoffset=2 xadvance=13 page=0 chnl=0 letter="W"
+char id=77 x=2 y=40 width=14 height=14 xoffset=0 yoffset=2 xadvance=12 page=0 chnl=0 letter="M"
+char id=65 x=18 y=40 width=14 height=14 xoffset=-1 yoffset=2 xadvance=9 page=0 chnl=0 letter="A"
+char id=86 x=34 y=40 width=14 height=14 xoffset=-1 yoffset=2 xadvance=9 page=0 chnl=0 letter="V"
+char id=88 x=50 y=40 width=14 height=14 xoffset=-1 yoffset=2 xadvance=9 page=0 chnl=0 letter="X"
+char id=89 x=66 y=40 width=14 height=14 xoffset=-1 yoffset=2 xadvance=9 page=0 chnl=0 letter="Y"
+char id=82 x=82 y=40 width=13 height=14 xoffset=0 yoffset=2 xadvance=10 page=0 chnl=0 letter="R"
+char id=68 x=97 y=40 width=13 height=14 xoffset=0 yoffset=2 xadvance=10 page=0 chnl=0 letter="D"
+char id=75 x=112 y=40 width=13 height=14 xoffset=0 yoffset=2 xadvance=9 page=0 chnl=0 letter="K"
+char id=84 x=127 y=40 width=13 height=14 xoffset=-1 yoffset=2 xadvance=9 page=0 chnl=0 letter="T"
+char id=90 x=142 y=40 width=13 height=14 xoffset=-1 yoffset=2 xadvance=9 page=0 chnl=0 letter="Z"
+char id=72 x=157 y=40 width=12 height=14 xoffset=0 yoffset=2 xadvance=10 page=0 chnl=0 letter="H"
+char id=78 x=171 y=40 width=12 height=14 xoffset=0 yoffset=2 xadvance=10 page=0 chnl=0 letter="N"
+char id=66 x=185 y=40 width=12 height=14 xoffset=0 yoffset=2 xadvance=9 page=0 chnl=0 letter="B"
+char id=80 x=199 y=40 width=12 height=14 xoffset=0 yoffset=2 xadvance=9 page=0 chnl=0 letter="P"
+char id=69 x=213 y=40 width=12 height=14 xoffset=0 yoffset=2 xadvance=9 page=0 chnl=0 letter="E"
+char id=52 x=227 y=40 width=12 height=14 xoffset=-1 yoffset=2 xadvance=8 page=0 chnl=0 letter="4"
+char id=50 x=241 y=40 width=12 height=14 xoffset=-1 yoffset=2 xadvance=8 page=0 chnl=0 letter="2"
+char id=55 x=2 y=56 width=12 height=14 xoffset=-1 yoffset=2 xadvance=8 page=0 chnl=0 letter="7"
+char id=70 x=16 y=56 width=11 height=14 xoffset=0 yoffset=2 xadvance=9 page=0 chnl=0 letter="F"
+char id=76 x=29 y=56 width=11 height=14 xoffset=0 yoffset=2 xadvance=8 page=0 chnl=0 letter="L"
+char id=104 x=42 y=56 width=11 height=14 xoffset=-1 yoffset=2 xadvance=8 page=0 chnl=0 letter="h"
+char id=107 x=55 y=56 width=11 height=14 xoffset=-1 yoffset=2 xadvance=7 page=0 chnl=0 letter="k"
+char id=49 x=68 y=56 width=9 height=14 xoffset=0 yoffset=2 xadvance=8 page=0 chnl=0 letter="1"
+char id=105 x=79 y=56 width=7 height=14 xoffset=-1 yoffset=2 xadvance=3 page=0 chnl=0 letter="i"
+char id=108 x=88 y=56 width=7 height=14 xoffset=-1 yoffset=2 xadvance=3 page=0 chnl=0 letter="l"
+char id=73 x=97 y=56 width=6 height=14 xoffset=0 yoffset=2 xadvance=4 page=0 chnl=0 letter="I"
+char id=33 x=105 y=56 width=6 height=14 xoffset=0 yoffset=2 xadvance=4 page=0 chnl=0 letter="!"
+char id=59 x=113 y=56 width=6 height=14 xoffset=0 yoffset=4 xadvance=4 page=0 chnl=0 letter=";"
+char id=111 x=121 y=56 width=12 height=13 xoffset=-1 yoffset=4 xadvance=8 page=0 chnl=0 letter="o"
+char id=97 x=135 y=56 width=12 height=13 xoffset=-1 yoffset=4 xadvance=8 page=0 chnl=0 letter="a"
+char id=101 x=149 y=56 width=12 height=13 xoffset=-1 yoffset=4 xadvance=8 page=0 chnl=0 letter="e"
+char id=99 x=163 y=56 width=11 height=13 xoffset=-1 yoffset=4 xadvance=7 page=0 chnl=0 letter="c"
+char id=115 x=176 y=56 width=11 height=13 xoffset=-1 yoffset=4 xadvance=7 page=0 chnl=0 letter="s"
+char id=117 x=189 y=56 width=11 height=13 xoffset=-1 yoffset=4 xadvance=8 page=0 chnl=0 letter="u"
+char id=109 x=202 y=56 width=15 height=12 xoffset=-1 yoffset=4 xadvance=12 page=0 chnl=0 letter="m"
+char id=119 x=219 y=56 width=14 height=12 xoffset=-1 yoffset=4 xadvance=10 page=0 chnl=0 letter="w"
+char id=60 x=235 y=56 width=12 height=12 xoffset=-1 yoffset=3 xadvance=8 page=0 chnl=0 letter="<"
+char id=62 x=2 y=72 width=12 height=12 xoffset=-1 yoffset=3 xadvance=8 page=0 chnl=0 letter=">"
+char id=43 x=16 y=72 width=12 height=12 xoffset=-1 yoffset=3 xadvance=8 page=0 chnl=0 letter="+"
+char id=118 x=30 y=72 width=11 height=12 xoffset=-1 yoffset=4 xadvance=7 page=0 chnl=0 letter="v"
+char id=120 x=43 y=72 width=11 height=12 xoffset=-1 yoffset=4 xadvance=7 page=0 chnl=0 letter="x"
+char id=122 x=56 y=72 width=11 height=12 xoffset=-1 yoffset=4 xadvance=7 page=0 chnl=0 letter="z"
+char id=110 x=69 y=72 width=11 height=12 xoffset=-1 yoffset=4 xadvance=8 page=0 chnl=0 letter="n"
+char id=114 x=82 y=72 width=9 height=12 xoffset=-1 yoffset=4 xadvance=5 page=0 chnl=0 letter="r"
+char id=58 x=93 y=72 width=6 height=12 xoffset=0 yoffset=4 xadvance=4 page=0 chnl=0 letter=":"
+char id=94 x=101 y=72 width=11 height=11 xoffset=-1 yoffset=1 xadvance=7 page=0 chnl=0 letter="^"
+char id=61 x=114 y=72 width=12 height=10 xoffset=-1 yoffset=4 xadvance=8 page=0 chnl=0 letter="="
+char id=42 x=128 y=72 width=9 height=9 xoffset=-1 yoffset=1 xadvance=5 page=0 chnl=0 letter="*"
+char id=34 x=139 y=72 width=9 height=8 xoffset=-1 yoffset=2 xadvance=5 page=0 chnl=0 letter="""
+char id=39 x=150 y=72 width=6 height=8 xoffset=-1 yoffset=2 xadvance=3 page=0 chnl=0 letter="'"
+char id=44 x=158 y=72 width=6 height=8 xoffset=0 yoffset=10 xadvance=4 page=0 chnl=0 letter=","
+char id=126 x=166 y=72 width=12 height=7 xoffset=-1 yoffset=6 xadvance=8 page=0 chnl=0 letter="~"
+char id=96 x=180 y=72 width=8 height=7 xoffset=-1 yoffset=1 xadvance=5 page=0 chnl=0 letter="`"
+char id=95 x=190 y=72 width=13 height=6 xoffset=-2 yoffset=13 xadvance=8 page=0 chnl=0 letter="_"
+char id=45 x=205 y=72 width=9 height=6 xoffset=-1 yoffset=7 xadvance=5 page=0 chnl=0 letter="-"
+char id=46 x=216 y=72 width=6 height=6 xoffset=0 yoffset=10 xadvance=4 page=0 chnl=0 letter="."
+char id=32 x=224 y=72 width=0 height=0 xoffset=0 yoffset=133 xadvance=4 page=0 chnl=0 letter="space"
+kernings count=82
+kerning first=64 second=42 amount=-1
+kerning first=79 second=102 amount=-1
+kerning first=79 second=82 amount=-1
+kerning first=47 second=52 amount=-1
+kerning first=63 second=126 amount=-1
+kerning first=121 second=44 amount=-1
+kerning first=121 second=46 amount=-1
+kerning first=87 second=65 amount=-1
+kerning first=87 second=97 amount=-1
+kerning first=87 second=44 amount=-1
+kerning first=87 second=46 amount=-1
+kerning first=65 second=87 amount=-1
+kerning first=65 second=86 amount=-1
+kerning first=65 second=89 amount=-1
+kerning first=65 second=84 amount=-1
+kerning first=65 second=32 amount=-1
+kerning first=86 second=121 amount=-1
+kerning first=86 second=65 amount=-1
+kerning first=86 second=59 amount=-1
+kerning first=86 second=111 amount=-1
+kerning first=86 second=97 amount=-1
+kerning first=86 second=101 amount=-1
+kerning first=86 second=117 amount=-1
+kerning first=86 second=114 amount=-1
+kerning first=86 second=58 amount=-1
+kerning first=86 second=44 amount=-1
+kerning first=86 second=45 amount=-1
+kerning first=86 second=46 amount=-1
+kerning first=89 second=112 amount=-1
+kerning first=89 second=113 amount=-1
+kerning first=89 second=65 amount=-1
+kerning first=89 second=105 amount=-1
+kerning first=89 second=59 amount=-1
+kerning first=89 second=111 amount=-1
+kerning first=89 second=97 amount=-1
+kerning first=89 second=101 amount=-1
+kerning first=89 second=117 amount=-1
+kerning first=89 second=118 amount=-1
+kerning first=89 second=58 amount=-1
+kerning first=89 second=44 amount=-2
+kerning first=89 second=45 amount=-1
+kerning first=89 second=46 amount=-2
+kerning first=84 second=121 amount=-1
+kerning first=84 second=65 amount=-1
+kerning first=84 second=105 amount=-1
+kerning first=84 second=59 amount=-2
+kerning first=84 second=111 amount=-2
+kerning first=84 second=97 amount=-2
+kerning first=84 second=101 amount=-2
+kerning first=84 second=99 amount=-2
+kerning first=84 second=115 amount=-2
+kerning first=84 second=117 amount=-1
+kerning first=84 second=119 amount=-1
+kerning first=84 second=114 amount=-1
+kerning first=84 second=58 amount=-2
+kerning first=84 second=44 amount=-2
+kerning first=84 second=45 amount=-1
+kerning first=84 second=46 amount=-2
+kerning first=80 second=65 amount=-1
+kerning first=80 second=62 amount=-1
+kerning first=80 second=44 amount=-2
+kerning first=80 second=46 amount=-2
+kerning first=70 second=65 amount=-1
+kerning first=70 second=44 amount=-2
+kerning first=70 second=46 amount=-2
+kerning first=76 second=121 amount=-1
+kerning first=76 second=87 amount=-1
+kerning first=76 second=86 amount=-1
+kerning first=76 second=89 amount=-1
+kerning first=76 second=84 amount=-1
+kerning first=76 second=32 amount=-1
+kerning first=49 second=49 amount=-1
+kerning first=33 second=102 amount=-1
+kerning first=119 second=44 amount=-1
+kerning first=119 second=46 amount=-1
+kerning first=62 second=35 amount=-1
+kerning first=118 second=44 amount=-1
+kerning first=118 second=46 amount=-1
+kerning first=114 second=44 amount=-1
+kerning first=114 second=46 amount=-1
+kerning first=32 second=92 amount=-1
+kerning first=32 second=65 amount=-1
diff --git a/games/MoonWarriors-Runtime/res/arial-14.png b/games/MoonWarriors-Runtime/res/arial-14.png
new file mode 100755
index 00000000..b9ef57eb
Binary files /dev/null and b/games/MoonWarriors-Runtime/res/arial-14.png differ
diff --git a/games/MoonWarriors-Runtime/res/b01.plist b/games/MoonWarriors-Runtime/res/b01.plist
new file mode 100755
index 00000000..8514592e
--- /dev/null
+++ b/games/MoonWarriors-Runtime/res/b01.plist
@@ -0,0 +1,72 @@
+
+
+
+
+ frames
+
+ lvl1_map1.png
+
+ frame
+ {{0,0},{240,240}}
+ offset
+ {0,0}
+ rotated
+
+ sourceColorRect
+ {{0,0},{240,240}}
+ sourceSize
+ {240,240}
+
+ lvl1_map2.png
+
+ frame
+ {{240,0},{240,240}}
+ offset
+ {0,0}
+ rotated
+
+ sourceColorRect
+ {{0,0},{240,240}}
+ sourceSize
+ {240,240}
+
+ lvl1_map3.png
+
+ frame
+ {{0,240},{240,240}}
+ offset
+ {0,0}
+ rotated
+
+ sourceColorRect
+ {{0,0},{240,240}}
+ sourceSize
+ {240,240}
+
+ lvl1_map4.png
+
+ frame
+ {{240,240},{240,240}}
+ offset
+ {0,0}
+ rotated
+
+ sourceColorRect
+ {{0,0},{240,240}}
+ sourceSize
+ {240,240}
+
+
+ metadata
+
+ format
+ 2
+ realTextureFileName
+ b01.png
+ size
+ {480,480}
+ textureFileName
+ b01.png
+
+
+
diff --git a/games/MoonWarriors-Runtime/res/b01.png b/games/MoonWarriors-Runtime/res/b01.png
new file mode 100755
index 00000000..46f10a6b
Binary files /dev/null and b/games/MoonWarriors-Runtime/res/b01.png differ
diff --git a/games/MoonWarriors-Runtime/res/cocos2d-html5.png b/games/MoonWarriors-Runtime/res/cocos2d-html5.png
new file mode 100755
index 00000000..bbf877b8
Binary files /dev/null and b/games/MoonWarriors-Runtime/res/cocos2d-html5.png differ
diff --git a/games/MoonWarriors-Runtime/res/dialog_bg.png b/games/MoonWarriors-Runtime/res/dialog_bg.png
new file mode 100755
index 00000000..a6718db9
Binary files /dev/null and b/games/MoonWarriors-Runtime/res/dialog_bg.png differ
diff --git a/games/MoonWarriors-Runtime/res/dialog_cancel_normal.png b/games/MoonWarriors-Runtime/res/dialog_cancel_normal.png
new file mode 100755
index 00000000..3359e9b8
Binary files /dev/null and b/games/MoonWarriors-Runtime/res/dialog_cancel_normal.png differ
diff --git a/games/MoonWarriors-Runtime/res/dialog_cancel_press.png b/games/MoonWarriors-Runtime/res/dialog_cancel_press.png
new file mode 100755
index 00000000..69ff93b9
Binary files /dev/null and b/games/MoonWarriors-Runtime/res/dialog_cancel_press.png differ
diff --git a/games/MoonWarriors-Runtime/res/dialog_confirm_normal.png b/games/MoonWarriors-Runtime/res/dialog_confirm_normal.png
new file mode 100755
index 00000000..4515c5db
Binary files /dev/null and b/games/MoonWarriors-Runtime/res/dialog_confirm_normal.png differ
diff --git a/games/MoonWarriors-Runtime/res/dialog_confirm_press.png b/games/MoonWarriors-Runtime/res/dialog_confirm_press.png
new file mode 100755
index 00000000..058aa071
Binary files /dev/null and b/games/MoonWarriors-Runtime/res/dialog_confirm_press.png differ
diff --git a/games/MoonWarriors-Runtime/res/explode.plist b/games/MoonWarriors-Runtime/res/explode.plist
new file mode 100755
index 00000000..e69de29b
diff --git a/games/MoonWarriors-Runtime/res/explosion.plist b/games/MoonWarriors-Runtime/res/explosion.plist
new file mode 100755
index 00000000..0e34916a
--- /dev/null
+++ b/games/MoonWarriors-Runtime/res/explosion.plist
@@ -0,0 +1,477 @@
+
+
+
+
+ frames
+
+ explosion_01.png
+
+ frame
+ {{158,348},{18,24}}
+ offset
+ {2,4}
+ rotated
+
+ sourceColorRect
+ {{57,48},{18,24}}
+ sourceSize
+ {128,128}
+
+ explosion_02.png
+
+ frame
+ {{296,258},{40,42}}
+ offset
+ {2,7}
+ rotated
+
+ sourceColorRect
+ {{46,36},{40,42}}
+ sourceSize
+ {128,128}
+
+ explosion_03.png
+
+ frame
+ {{220,210},{42,48}}
+ offset
+ {3,8}
+ rotated
+
+ sourceColorRect
+ {{46,32},{42,48}}
+ sourceSize
+ {128,128}
+
+ explosion_04.png
+
+ frame
+ {{264,210},{46,60}}
+ offset
+ {2,0}
+ rotated
+
+ sourceColorRect
+ {{43,34},{46,60}}
+ sourceSize
+ {128,128}
+
+ explosion_05.png
+
+ frame
+ {{2,458},{50,56}}
+ offset
+ {1,-4}
+ rotated
+
+ sourceColorRect
+ {{40,40},{50,56}}
+ sourceSize
+ {128,128}
+
+ explosion_06.png
+
+ frame
+ {{60,458},{48,56}}
+ offset
+ {-1,-3}
+ rotated
+
+ sourceColorRect
+ {{39,39},{48,56}}
+ sourceSize
+ {128,128}
+
+ explosion_07.png
+
+ frame
+ {{160,210},{56,58}}
+ offset
+ {0,-2}
+ rotated
+
+ sourceColorRect
+ {{36,37},{56,58}}
+ sourceSize
+ {128,128}
+
+ explosion_08.png
+
+ frame
+ {{292,72},{60,64}}
+ offset
+ {-3,-5}
+ rotated
+
+ sourceColorRect
+ {{31,37},{60,64}}
+ sourceSize
+ {128,128}
+
+ explosion_09.png
+
+ frame
+ {{160,70},{70,68}}
+ offset
+ {-4,-7}
+ rotated
+
+ sourceColorRect
+ {{25,37},{70,68}}
+ sourceSize
+ {128,128}
+
+ explosion_10.png
+
+ frame
+ {{252,428},{76,76}}
+ offset
+ {-4,-6}
+ rotated
+
+ sourceColorRect
+ {{22,32},{76,76}}
+ sourceSize
+ {128,128}
+
+ explosion_11.png
+
+ frame
+ {{76,284},{80,84}}
+ offset
+ {-2,-2}
+ rotated
+
+ sourceColorRect
+ {{22,24},{80,84}}
+ sourceSize
+ {128,128}
+
+ explosion_12.png
+
+ frame
+ {{2,372},{80,84}}
+ offset
+ {-1,4}
+ rotated
+
+ sourceColorRect
+ {{23,18},{80,84}}
+ sourceSize
+ {128,128}
+
+ explosion_13.png
+
+ frame
+ {{84,370},{74,84}}
+ offset
+ {4,3}
+ rotated
+
+ sourceColorRect
+ {{31,19},{74,84}}
+ sourceSize
+ {128,128}
+
+ explosion_14.png
+
+ frame
+ {{84,186},{74,80}}
+ offset
+ {6,-4}
+ rotated
+
+ sourceColorRect
+ {{33,28},{74,80}}
+ sourceSize
+ {128,128}
+
+ explosion_15.png
+
+ frame
+ {{2,194},{80,88}}
+ offset
+ {6,-4}
+ rotated
+
+ sourceColorRect
+ {{30,24},{80,88}}
+ sourceSize
+ {128,128}
+
+ explosion_16.png
+
+ frame
+ {{2,2},{82,98}}
+ offset
+ {6,-4}
+ rotated
+
+ sourceColorRect
+ {{29,19},{82,98}}
+ sourceSize
+ {128,128}
+
+ explosion_17.png
+
+ frame
+ {{2,102},{80,90}}
+ offset
+ {10,-3}
+ rotated
+
+ sourceColorRect
+ {{34,22},{80,90}}
+ sourceSize
+ {128,128}
+
+ explosion_18.png
+
+ frame
+ {{158,268},{78,74}}
+ offset
+ {14,-1}
+ rotated
+
+ sourceColorRect
+ {{39,28},{78,74}}
+ sourceSize
+ {128,128}
+
+ explosion_19.png
+
+ frame
+ {{2,284},{86,72}}
+ offset
+ {14,1}
+ rotated
+
+ sourceColorRect
+ {{35,27},{86,72}}
+ sourceSize
+ {128,128}
+
+ explosion_20.png
+
+ frame
+ {{160,368},{78,70}}
+ offset
+ {7,0}
+ rotated
+
+ sourceColorRect
+ {{32,29},{78,70}}
+ sourceSize
+ {128,128}
+
+ explosion_21.png
+
+ frame
+ {{330,2},{76,66}}
+ offset
+ {4,-1}
+ rotated
+
+ sourceColorRect
+ {{30,32},{76,66}}
+ sourceSize
+ {128,128}
+
+ explosion_22.png
+
+ frame
+ {{354,70},{58,58}}
+ offset
+ {-2,1}
+ rotated
+
+ sourceColorRect
+ {{33,34},{58,58}}
+ sourceSize
+ {128,128}
+
+ explosion_23.png
+
+ frame
+ {{234,260},{64,60}}
+ offset
+ {1,1}
+ rotated
+
+ sourceColorRect
+ {{33,33},{64,60}}
+ sourceSize
+ {128,128}
+
+ explosion_24.png
+
+ frame
+ {{408,2},{70,66}}
+ offset
+ {4,-2}
+ rotated
+
+ sourceColorRect
+ {{33,33},{70,66}}
+ sourceSize
+ {128,128}
+
+ explosion_25.png
+
+ frame
+ {{86,2},{72,80}}
+ offset
+ {10,-2}
+ rotated
+
+ sourceColorRect
+ {{38,26},{72,80}}
+ sourceSize
+ {128,128}
+
+ explosion_26.png
+
+ frame
+ {{84,102},{74,82}}
+ offset
+ {10,-3}
+ rotated
+
+ sourceColorRect
+ {{37,26},{74,82}}
+ sourceSize
+ {128,128}
+
+ explosion_27.png
+
+ frame
+ {{118,456},{54,64}}
+ offset
+ {6,2}
+ rotated
+
+ sourceColorRect
+ {{43,30},{54,64}}
+ sourceSize
+ {128,128}
+
+ explosion_28.png
+
+ frame
+ {{296,138},{58,62}}
+ offset
+ {5,4}
+ rotated
+
+ sourceColorRect
+ {{40,29},{58,62}}
+ sourceSize
+ {128,128}
+
+ explosion_29.png
+
+ frame
+ {{184,448},{62,66}}
+ offset
+ {5,5}
+ rotated
+
+ sourceColorRect
+ {{38,26},{62,66}}
+ sourceSize
+ {128,128}
+
+ explosion_30.png
+
+ frame
+ {{160,140},{66,68}}
+ offset
+ {4,6}
+ rotated
+
+ sourceColorRect
+ {{35,24},{66,68}}
+ sourceSize
+ {128,128}
+
+ explosion_31.png
+
+ frame
+ {{234,2},{72,68}}
+ offset
+ {4,5}
+ rotated
+
+ sourceColorRect
+ {{32,25},{72,68}}
+ sourceSize
+ {128,128}
+
+ explosion_32.png
+
+ frame
+ {{232,348},{78,68}}
+ offset
+ {4,6}
+ rotated
+
+ sourceColorRect
+ {{29,24},{78,68}}
+ sourceSize
+ {128,128}
+
+ explosion_33.png
+
+ frame
+ {{160,2},{72,66}}
+ offset
+ {9,9}
+ rotated
+
+ sourceColorRect
+ {{37,22},{72,66}}
+ sourceSize
+ {128,128}
+
+ explosion_34.png
+
+ frame
+ {{228,140},{68,66}}
+ offset
+ {9,17}
+ rotated
+
+ sourceColorRect
+ {{39,14},{68,66}}
+ sourceSize
+ {128,128}
+
+ explosion_35.png
+
+ frame
+ {{232,72},{66,58}}
+ offset
+ {12,14}
+ rotated
+
+ sourceColorRect
+ {{43,21},{66,58}}
+ sourceSize
+ {128,128}
+
+
+ metadata
+
+ format
+ 2
+ realTextureFileName
+ explosion.png
+ size
+ {512,512}
+ smartupdate
+ $TexturePacker:SmartUpdate:32444a4ee5ed4b15bbb0544a15090343$
+ textureFileName
+ explosion.png
+
+
+
diff --git a/games/MoonWarriors-Runtime/res/explosion.png b/games/MoonWarriors-Runtime/res/explosion.png
new file mode 100755
index 00000000..97bca7d4
Binary files /dev/null and b/games/MoonWarriors-Runtime/res/explosion.png differ
diff --git a/games/MoonWarriors-Runtime/res/flare.jpg b/games/MoonWarriors-Runtime/res/flare.jpg
new file mode 100755
index 00000000..1434edfa
Binary files /dev/null and b/games/MoonWarriors-Runtime/res/flare.jpg differ
diff --git a/games/MoonWarriors-Runtime/res/gameOver.png b/games/MoonWarriors-Runtime/res/gameOver.png
new file mode 100755
index 00000000..9597adb7
Binary files /dev/null and b/games/MoonWarriors-Runtime/res/gameOver.png differ
diff --git a/games/MoonWarriors-Runtime/res/level01.tmx b/games/MoonWarriors-Runtime/res/level01.tmx
new file mode 100755
index 00000000..7c04ddca
--- /dev/null
+++ b/games/MoonWarriors-Runtime/res/level01.tmx
@@ -0,0 +1,12 @@
+
+
+
diff --git a/games/MoonWarriors-Runtime/res/loading.png b/games/MoonWarriors-Runtime/res/loading.png
new file mode 100755
index 00000000..4df7215f
Binary files /dev/null and b/games/MoonWarriors-Runtime/res/loading.png differ
diff --git a/games/MoonWarriors-Runtime/res/logo.png b/games/MoonWarriors-Runtime/res/logo.png
new file mode 100755
index 00000000..7cfb6471
Binary files /dev/null and b/games/MoonWarriors-Runtime/res/logo.png differ
diff --git a/games/MoonWarriors-Runtime/res/menu.png b/games/MoonWarriors-Runtime/res/menu.png
new file mode 100755
index 00000000..36ea9b38
Binary files /dev/null and b/games/MoonWarriors-Runtime/res/menu.png differ
diff --git a/games/MoonWarriors-Runtime/res/menuTitle.png b/games/MoonWarriors-Runtime/res/menuTitle.png
new file mode 100755
index 00000000..8df2d07c
Binary files /dev/null and b/games/MoonWarriors-Runtime/res/menuTitle.png differ
diff --git a/games/MoonWarriors-Runtime/res/sg.zip b/games/MoonWarriors-Runtime/res/sg.zip
new file mode 100644
index 00000000..03ff7f5f
Binary files /dev/null and b/games/MoonWarriors-Runtime/res/sg.zip differ
diff --git a/games/MoonWarriors-Runtime/res/textureOpaquePack.plist b/games/MoonWarriors-Runtime/res/textureOpaquePack.plist
new file mode 100755
index 00000000..98a3fd09
--- /dev/null
+++ b/games/MoonWarriors-Runtime/res/textureOpaquePack.plist
@@ -0,0 +1,98 @@
+
+
+
+
+ frames
+
+ W1.png
+
+ frame
+ {{2,232},{14,62}}
+ offset
+ {0,0}
+ rotated
+
+ sourceColorRect
+ {{0,0},{14,62}}
+ sourceSize
+ {14,62}
+
+ W2.png
+
+ frame
+ {{36,198},{25,25}}
+ offset
+ {0,0}
+ rotated
+
+ sourceColorRect
+ {{0,0},{25,25}}
+ sourceSize
+ {25,25}
+
+ explode1.png
+
+ frame
+ {{100,2},{96,96}}
+ offset
+ {0,0}
+ rotated
+
+ sourceColorRect
+ {{0,0},{96,96}}
+ sourceSize
+ {96,96}
+
+ explode2.png
+
+ frame
+ {{2,100},{96,96}}
+ offset
+ {0,0}
+ rotated
+
+ sourceColorRect
+ {{0,0},{96,96}}
+ sourceSize
+ {96,96}
+
+ explode3.png
+
+ frame
+ {{2,2},{96,96}}
+ offset
+ {0,0}
+ rotated
+
+ sourceColorRect
+ {{0,0},{96,96}}
+ sourceSize
+ {96,96}
+
+ hit.png
+
+ frame
+ {{2,198},{32,32}}
+ offset
+ {0,0}
+ rotated
+
+ sourceColorRect
+ {{0,0},{32,32}}
+ sourceSize
+ {32,32}
+
+
+ metadata
+
+ format
+ 2
+ realTextureFileName
+ textureOpaquePack.png
+ size
+ {256,256}
+ textureFileName
+ textureOpaquePack.png
+
+
+
diff --git a/games/MoonWarriors-Runtime/res/textureOpaquePack.png b/games/MoonWarriors-Runtime/res/textureOpaquePack.png
new file mode 100755
index 00000000..214fd490
Binary files /dev/null and b/games/MoonWarriors-Runtime/res/textureOpaquePack.png differ
diff --git a/games/MoonWarriors-Runtime/res/textureTransparentPack.plist b/games/MoonWarriors-Runtime/res/textureTransparentPack.plist
new file mode 100755
index 00000000..2cdca554
--- /dev/null
+++ b/games/MoonWarriors-Runtime/res/textureTransparentPack.plist
@@ -0,0 +1,150 @@
+
+
+
+
+ frames
+
+ E0.png
+
+ frame
+ {{324,89},{46,26}}
+ offset
+ {-1,0}
+ rotated
+
+ sourceColorRect
+ {{0,1},{46,26}}
+ sourceSize
+ {48,28}
+
+ E1.png
+
+ frame
+ {{473,2},{55,31}}
+ offset
+ {-1,0}
+ rotated
+
+ sourceColorRect
+ {{2,0},{55,31}}
+ sourceSize
+ {61,31}
+
+ E2.png
+
+ frame
+ {{469,59},{55,41}}
+ offset
+ {1,-1}
+ rotated
+
+ sourceColorRect
+ {{2,3},{55,41}}
+ sourceSize
+ {57,45}
+
+ E3.png
+
+ frame
+ {{406,2},{65,31}}
+ offset
+ {1,0}
+ rotated
+
+ sourceColorRect
+ {{2,0},{65,31}}
+ sourceSize
+ {67,31}
+
+ E4.png
+
+ frame
+ {{324,49},{61,38}}
+ offset
+ {0,-1}
+ rotated
+
+ sourceColorRect
+ {{1,2},{61,38}}
+ sourceSize
+ {63,40}
+
+ E5.png
+
+ frame
+ {{324,2},{80,45}}
+ offset
+ {0,0}
+ rotated
+
+ sourceColorRect
+ {{2,1},{80,45}}
+ sourceSize
+ {84,47}
+
+ bg01.png
+
+ frame
+ {{2,2},{320,575}}
+ offset
+ {0,0}
+ rotated
+
+ sourceColorRect
+ {{0,0},{320,575}}
+ sourceSize
+ {320,575}
+
+ ship01.png
+
+ frame
+ {{449,116},{59,45}}
+ offset
+ {0,0}
+ rotated
+
+ sourceColorRect
+ {{0,0},{59,45}}
+ sourceSize
+ {59,45}
+
+ ship02.png
+
+ frame
+ {{406,35},{61,44}}
+ offset
+ {0,0}
+ rotated
+
+ sourceColorRect
+ {{0,0},{61,44}}
+ sourceSize
+ {61,44}
+
+ ship03.png
+
+ frame
+ {{387,81},{60,38}}
+ offset
+ {0,0}
+ rotated
+
+ sourceColorRect
+ {{0,0},{60,38}}
+ sourceSize
+ {60,38}
+
+
+ metadata
+
+ format
+ 2
+ realTextureFileName
+ textureTransparentPack.png
+ size
+ {512,1024}
+ textureFileName
+ textureTransparentPack.png
+
+
+
diff --git a/games/MoonWarriors-Runtime/res/textureTransparentPack.png b/games/MoonWarriors-Runtime/res/textureTransparentPack.png
new file mode 100755
index 00000000..c026ae46
Binary files /dev/null and b/games/MoonWarriors-Runtime/res/textureTransparentPack.png differ
diff --git a/games/MoonWarriors-Runtime/res_engine/dialog_bg.png b/games/MoonWarriors-Runtime/res_engine/dialog_bg.png
new file mode 100644
index 00000000..ffaa453b
Binary files /dev/null and b/games/MoonWarriors-Runtime/res_engine/dialog_bg.png differ
diff --git a/games/MoonWarriors-Runtime/res_engine/dialog_cancel_normal.png b/games/MoonWarriors-Runtime/res_engine/dialog_cancel_normal.png
new file mode 100644
index 00000000..3386c018
Binary files /dev/null and b/games/MoonWarriors-Runtime/res_engine/dialog_cancel_normal.png differ
diff --git a/games/MoonWarriors-Runtime/res_engine/dialog_cancel_press.png b/games/MoonWarriors-Runtime/res_engine/dialog_cancel_press.png
new file mode 100644
index 00000000..6d9d565c
Binary files /dev/null and b/games/MoonWarriors-Runtime/res_engine/dialog_cancel_press.png differ
diff --git a/games/MoonWarriors-Runtime/res_engine/dialog_confirm_normal.png b/games/MoonWarriors-Runtime/res_engine/dialog_confirm_normal.png
new file mode 100644
index 00000000..3a7e34cc
Binary files /dev/null and b/games/MoonWarriors-Runtime/res_engine/dialog_confirm_normal.png differ
diff --git a/games/MoonWarriors-Runtime/res_engine/dialog_confirm_press.png b/games/MoonWarriors-Runtime/res_engine/dialog_confirm_press.png
new file mode 100644
index 00000000..21a22ea0
Binary files /dev/null and b/games/MoonWarriors-Runtime/res_engine/dialog_confirm_press.png differ
diff --git a/games/MoonWarriors-Runtime/res_engine/preload_bg.jpg b/games/MoonWarriors-Runtime/res_engine/preload_bg.jpg
new file mode 100644
index 00000000..47f75d78
Binary files /dev/null and b/games/MoonWarriors-Runtime/res_engine/preload_bg.jpg differ
diff --git a/games/MoonWarriors-Runtime/res_engine/preload_logo.png b/games/MoonWarriors-Runtime/res_engine/preload_logo.png
new file mode 100644
index 00000000..d856c500
Binary files /dev/null and b/games/MoonWarriors-Runtime/res_engine/preload_logo.png differ
diff --git a/games/MoonWarriors-Runtime/res_engine/preload_title.png b/games/MoonWarriors-Runtime/res_engine/preload_title.png
new file mode 100644
index 00000000..73d4119b
Binary files /dev/null and b/games/MoonWarriors-Runtime/res_engine/preload_title.png differ
diff --git a/games/MoonWarriors-Runtime/res_engine/progress_bar.png b/games/MoonWarriors-Runtime/res_engine/progress_bar.png
new file mode 100644
index 00000000..0f55b6dd
Binary files /dev/null and b/games/MoonWarriors-Runtime/res_engine/progress_bar.png differ
diff --git a/games/MoonWarriors-Runtime/res_engine/progress_bg.png b/games/MoonWarriors-Runtime/res_engine/progress_bg.png
new file mode 100644
index 00000000..4626934e
Binary files /dev/null and b/games/MoonWarriors-Runtime/res_engine/progress_bg.png differ
diff --git a/games/MoonWarriors-Runtime/res_engine/progress_light.png b/games/MoonWarriors-Runtime/res_engine/progress_light.png
new file mode 100644
index 00000000..2ca65551
Binary files /dev/null and b/games/MoonWarriors-Runtime/res_engine/progress_light.png differ
diff --git a/games/MoonWarriors-Runtime/res_engine/progress_shadow.png b/games/MoonWarriors-Runtime/res_engine/progress_shadow.png
new file mode 100644
index 00000000..4abfffee
Binary files /dev/null and b/games/MoonWarriors-Runtime/res_engine/progress_shadow.png differ
diff --git a/games/MoonWarriors-Runtime/src/AboutLayer.js b/games/MoonWarriors-Runtime/src/AboutLayer.js
new file mode 100755
index 00000000..17ea488a
--- /dev/null
+++ b/games/MoonWarriors-Runtime/src/AboutLayer.js
@@ -0,0 +1,43 @@
+var AboutLayer = cc.Layer.extend({
+ init:function () {
+ var bRet = false;
+ if (this._super()) {
+ var sp = cc.Sprite.create(res.loading_png);
+ sp.setAnchorPoint(0,0);
+ this.addChild(sp, 0, 1);
+
+ var cacheImage = cc.TextureCache.getInstance().addImage(res.menuTitle_png);
+ var title = cc.Sprite.createWithTexture(cacheImage, cc.rect(0, 36, 100, 34));
+ title.setPosition( winSize.width / 2, winSize.height - 60 );
+ this.addChild(title);
+
+ // There is a bug in LabelTTF native. Apparently it fails with some unicode chars.
+ var about = cc.LabelTTF.create(" This showcase utilizes many features from Cocos2d-html5 engine, including: Parallax background, tilemap, actions, ease, frame animation, schedule, Labels, keyboard Dispatcher, Scene Transition. \n Art and audio is copyrighted by Enigmata Genus Revenge, you may not use any copyrigted material without permission. This showcase is licensed under GPL. \n \n Programmer: \n Shengxiang Chen (陈升想) \n Dingping Lv (吕定平) \n Effects animation: Hao Wu(吴昊)\n Quality Assurance: Sean Lin(林顺)", "Arial", 14, cc.size(winSize.width * 0.85, 320), cc.TEXT_ALIGNMENT_LEFT );
+ about.setPosition(winSize.width / 2, winSize.height/2 -20 );
+ about.setAnchorPoint(0.5, 0.5 );
+ this.addChild(about);
+
+ var label = cc.LabelTTF.create("Go back", "Arial", 14);
+ var back = cc.MenuItemLabel.create(label, this.onBackCallback);
+ var menu = cc.Menu.create(back);
+ menu.setPosition( winSize.width / 2, 40);
+ this.addChild(menu);
+ bRet = true;
+ }
+
+ return bRet;
+ },
+ onBackCallback:function (pSender) {
+ var scene = cc.Scene.create();
+ scene.addChild(SysMenu.create());
+ cc.Director.getInstance().replaceScene(cc.TransitionFade.create(1.2, scene));
+ }
+});
+
+AboutLayer.create = function () {
+ var sg = new AboutLayer();
+ if (sg && sg.init()) {
+ return sg;
+ }
+ return null;
+};
diff --git a/games/MoonWarriors-Runtime/src/Background.js b/games/MoonWarriors-Runtime/src/Background.js
new file mode 100755
index 00000000..b55beee0
--- /dev/null
+++ b/games/MoonWarriors-Runtime/src/Background.js
@@ -0,0 +1,95 @@
+var BackSky = cc.Sprite.extend({
+ active:true,
+ ctor:function () {
+ this._super();
+ this.initWithSpriteFrameName("bg01.png");
+ this.setAnchorPoint(0, 0);
+ },
+ destroy:function () {
+ this.setVisible(false);
+ this.active = false;
+ }
+});
+
+BackSky.create = function () {
+ var background = new BackSky();
+ g_sharedGameLayer.addChild(background, -10);
+ MW.CONTAINER.BACKSKYS.push(background);
+ return background;
+};
+
+BackSky.getOrCreate = function () {
+ var selChild = null;
+ for (var j = 0; j < MW.CONTAINER.BACKSKYS.length; j++) {
+ selChild = MW.CONTAINER.BACKSKYS[j];
+ if (selChild.active == false) {
+ selChild.setVisible(true);
+ selChild.active = true;
+ return selChild;
+ }
+ }
+ selChild = BackSky.create();
+ return selChild;
+};
+
+
+BackSky.preSet = function () {
+ var background = null;
+ for (var i = 0; i < 2; i++) {
+ background = BackSky.create();
+ background.setVisible(false);
+ background.active = false;
+ }
+};
+
+var BackTileMapLvl1 = [
+ "lvl1_map1.png",
+ "lvl1_map2.png",
+ "lvl1_map3.png",
+ "lvl1_map4.png"
+];
+
+var BackTileMap = cc.Sprite.extend({
+ active:true,
+ ctor:function (frameName) {
+ this._super();
+ this.initWithSpriteFrameName(frameName);
+ this.setAnchorPoint(0.5, 0);
+ },
+ destroy:function () {
+ this.setVisible(false);
+ this.active = false;
+ }
+});
+
+BackTileMap.create = function (frameName) {
+ var backTileMap = new BackTileMap(frameName);
+ g_sharedGameLayer.addChild(backTileMap, -9);
+ MW.CONTAINER.BACKTILEMAPS.push(backTileMap);
+ return backTileMap;
+};
+
+BackTileMap.getOrCreate = function () {
+ var selChild = null;
+ for (var j = 0; j < MW.CONTAINER.BACKTILEMAPS.length; j++) {
+ selChild = MW.CONTAINER.BACKTILEMAPS[j];
+ if (selChild.active == false) {
+ selChild.setVisible(true);
+ selChild.active = true;
+ return selChild;
+ }
+ }
+ selChild = BackTileMap.create(BackTileMapLvl1[0|Math.random()*4]);
+ return selChild;
+};
+
+
+BackTileMap.preSet = function () {
+ var backTileMap = null;
+ for (var i = 0; i < BackTileMapLvl1.length; i++) {
+ backTileMap = BackTileMap.create(BackTileMapLvl1[i]);
+ backTileMap.setVisible(false);
+ backTileMap.active = false;
+ }
+};
+
diff --git a/games/MoonWarriors-Runtime/src/Bullet.js b/games/MoonWarriors-Runtime/src/Bullet.js
new file mode 100755
index 00000000..cac90701
--- /dev/null
+++ b/games/MoonWarriors-Runtime/src/Bullet.js
@@ -0,0 +1,92 @@
+//bullet
+var Bullet = cc.Sprite.extend({
+ active:true,
+ xVelocity:0,
+ yVelocity:200,
+ power:1,
+ HP:1,
+ moveType:null,
+ zOrder:3000,
+ attackMode:MW.ENEMY_MOVE_TYPE.NORMAL,
+ parentType:MW.BULLET_TYPE.PLAYER,
+ ctor:function (bulletSpeed, weaponType, attackMode) {
+ this._super();
+
+ this.yVelocity = -bulletSpeed;
+ this.attackMode = attackMode;
+ this.initWithSpriteFrameName(weaponType);
+ this.setBlendFunc(gl.SRC_ALPHA, gl.ONE);
+ },
+ update:function (dt) {
+ var p = this.getPosition();
+ this.setPosition(p.x - this.xVelocity * dt, p.y - this.yVelocity * dt);
+ if (p.x < 0 || p.x > g_sharedGameLayer.screenRect.width || p.y < 0 || p.y > g_sharedGameLayer.screenRect.height || this.HP <= 0) {
+ this.destroy();
+ }
+ },
+ destroy:function () {
+ var explode = HitEffect.getOrCreateHitEffect(this.getPosition(), Math.random() * 360, 0.75);
+ this.active = false;
+ this.setVisible(false);
+ },
+ hurt:function () {
+ this.HP--;
+ },
+ collideRect:function (p) {
+ return cc.rect(p.x - 3, p.y - 3, 6, 6);
+ }
+});
+
+Bullet.getOrCreateBullet = function (bulletSpeed, weaponType, attackMode, zOrder, mode) {
+ /**/
+ var selChild = null;
+ if (mode == MW.UNIT_TAG.PLAYER_BULLET) {
+ for (var j = 0; j < MW.CONTAINER.PLAYER_BULLETS.length; j++) {
+ selChild = MW.CONTAINER.PLAYER_BULLETS[j];
+ if (selChild.active == false) {
+ selChild.setVisible(true);
+ selChild.HP = 1;
+ selChild.active = true;
+ return selChild;
+ }
+ }
+ }
+ else {
+ for (var j = 0; j < MW.CONTAINER.ENEMY_BULLETS.length; j++) {
+ selChild = MW.CONTAINER.ENEMY_BULLETS[j];
+ if (selChild.active == false) {
+ selChild.setVisible(true);
+ selChild.HP = 1;
+ selChild.active = true;
+ return selChild;
+ }
+ }
+ }
+ selChild = Bullet.create(bulletSpeed, weaponType, attackMode, zOrder, mode);
+ return selChild;
+};
+
+Bullet.create = function (bulletSpeed, weaponType, attackMode, zOrder, mode) {
+ var bullet = new Bullet(bulletSpeed, weaponType, attackMode);
+ g_sharedGameLayer.addBullet(bullet, zOrder, mode);
+ if (mode == MW.UNIT_TAG.PLAYER_BULLET) {
+ MW.CONTAINER.PLAYER_BULLETS.push(bullet);
+ } else {
+ MW.CONTAINER.ENEMY_BULLETS.push(bullet);
+ }
+ return bullet;
+};
+
+Bullet.preSet = function () {
+ var bullet = null;
+ for (var i = 0; i < 10; i++) {
+ var bullet = Bullet.create(MW.BULLET_SPEED.SHIP, "W1.png", MW.ENEMY_ATTACK_MODE.NORMAL, 3000, MW.UNIT_TAG.PLAYER_BULLET);
+ bullet.setVisible(false);
+ bullet.active = false;
+ }
+ for (var i = 0; i < 10; i++) {
+ bullet = Bullet.create(MW.BULLET_SPEED.ENEMY, "W2.png", MW.ENEMY_ATTACK_MODE.NORMAL, 3000, MW.UNIT_TAG.ENMEY_BULLET);
+ bullet.setVisible(false);
+ bullet.active = false;
+ }
+};
diff --git a/games/MoonWarriors-Runtime/src/Effect.js b/games/MoonWarriors-Runtime/src/Effect.js
new file mode 100755
index 00000000..91db8d37
--- /dev/null
+++ b/games/MoonWarriors-Runtime/src/Effect.js
@@ -0,0 +1,74 @@
+var flareEffect = function (flare,target, callback) {
+ flare.setVisible(true);
+ flare.stopAllActions();
+ flare.setBlendFunc(gl.SRC_ALPHA, gl.ONE);
+ flare.setOpacity(0);
+ flare.setPosition(-30, 297);
+ flare.setRotation(-120);
+ flare.setScale(0.2);
+
+ var opacityAnim = cc.FadeTo.create(0.5, 255);
+ var opacDim = cc.FadeTo.create(1, 0);
+ var biggeAnim = cc.ScaleBy.create(0.7, 1.2, 1.2);
+ var biggerEase = cc.EaseSineOut.create(biggeAnim);
+ var moveAnim = cc.MoveBy.create(0.5, cc.p(328, 0));
+ var easeMove = cc.EaseSineOut.create(moveAnim);
+ var rotateAnim = cc.RotateBy.create(2.5, 90);
+ var rotateEase = cc.EaseExponentialOut.create(rotateAnim);
+ var bigger = cc.ScaleTo.create(0.5, 1);
+
+ var onComplete = cc.CallFunc.create(callback, target);
+ var killflare = cc.CallFunc.create(function () {
+ this.getParent().removeChild(this,true);
+ }, flare);
+ flare.runAction(cc.Sequence.create(opacityAnim, biggerEase, opacDim, killflare, onComplete));
+ flare.runAction(easeMove);
+ flare.runAction(rotateEase);
+ flare.runAction(bigger);
+};
+
+var removeFromParent = function( sprite )
+{
+ sprite.removeFromParent();
+};
+
+var spark = function (ccpoint, parent, scale, duration) {
+ scale = scale || 0.3;
+ duration = duration || 0.5;
+
+ var one = cc.Sprite.createWithSpriteFrameName("explode1.png");
+ var two = cc.Sprite.createWithSpriteFrameName("explode2.png");
+ var three = cc.Sprite.createWithSpriteFrameName("explode3.png");
+
+ one.setPosition(ccpoint);
+ two.setPosition(ccpoint);
+ three.setPosition(ccpoint);
+
+ //parent.addChild(one);
+ parent.addSpark(two);
+ parent.addSpark(three);
+ one.setScale(scale);
+ two.setScale(scale);
+ three.setScale(scale);
+
+ three.setRotation(Math.random() * 360);
+
+ var left = cc.RotateBy.create(duration, -45);
+ var right = cc.RotateBy.create(duration, 45);
+ var scaleBy = cc.ScaleBy.create(duration, 3, 3);
+ var fadeOut = cc.FadeOut.create(duration);
+ var remove = cc.CallFunc.create(removeFromParent, this);
+ var seq = cc.Sequence.create( fadeOut, remove );
+
+ one.runAction(left);
+ two.runAction(right);
+
+ one.runAction(scaleBy);
+ two.runAction(scaleBy.clone());
+ three.runAction(scaleBy.clone());
+
+ one.runAction(seq);
+ two.runAction(seq.clone() );
+ three.runAction(seq.clone());
+};
+
diff --git a/games/MoonWarriors-Runtime/src/Enemy.js b/games/MoonWarriors-Runtime/src/Enemy.js
new file mode 100755
index 00000000..0630b2b3
--- /dev/null
+++ b/games/MoonWarriors-Runtime/src/Enemy.js
@@ -0,0 +1,119 @@
+var Enemy = cc.Sprite.extend({
+ eID:0,
+ enemyType:1,
+ active:true,
+ speed:200,
+ bulletSpeed:MW.BULLET_SPEED.ENEMY,
+ HP:15,
+ bulletPowerValue:1,
+ moveType:null,
+ scoreValue:200,
+ zOrder:1000,
+ delayTime:1 + 1.2 * Math.random(),
+ attackMode:MW.ENEMY_MOVE_TYPE.NORMAL,
+ _hurtColorLife:0,
+ ctor:function (arg) {
+ this._super();
+
+ this.HP = arg.HP;
+ this.moveType = arg.moveType;
+ this.scoreValue = arg.scoreValue;
+ this.attackMode = arg.attackMode;
+ this.enemyType = arg.type;
+
+ this.initWithSpriteFrameName(arg.textureName);
+ this.schedule(this.shoot, this.delayTime);
+ },
+ _timeTick:0,
+ update:function (dt) {
+ var p = this.getPosition();
+ if ((p.x < 0 || p.x > 320) && (p.y < 0 || p.y > 480)) {
+ this.active = false;
+ }
+ this._timeTick += dt;
+ if (this._timeTick > 0.1) {
+ this._timeTick = 0;
+ if (this._hurtColorLife > 0) {
+ this._hurtColorLife--;
+ }
+ }
+
+ var p = this.getPosition();
+ if (p.x < 0 || p.x > g_sharedGameLayer.screenRect.width || p.y < 0 || p.y > g_sharedGameLayer.screenRect.height || this.HP <= 0) {
+ this.active = false;
+ this.destroy();
+ }
+
+ },
+ destroy:function () {
+ MW.SCORE += this.scoreValue;
+ var a = Explosion.getOrCreateExplosion();
+ a.setPosition(this.getPosition());
+ SparkEffect.getOrCreateSparkEffect(this.getPosition());
+ if (MW.SOUND) {
+ cc.AudioEngine.getInstance().playEffect(res.explodeEffect_mp3);
+ }
+ this.setVisible(false);
+ this.active = false;
+ this.stopAllActions();
+ this.unschedule(this.shoot);
+ MW.ACTIVE_ENEMIES--;
+ },
+ shoot:function () {
+ var p = this.getPosition();
+ var b = Bullet.getOrCreateBullet(this.bulletSpeed, "W2.png", this.attackMode, 3000, MW.UNIT_TAG.ENMEY_BULLET);
+ b.setPosition(p.x, p.y - this.getContentSize().height * 0.2);
+ },
+ hurt:function () {
+ this._hurtColorLife = 2;
+ this.HP--;
+ },
+ collideRect:function (p) {
+ var a = this.getContentSize();
+ return cc.rect(p.x - a.width / 2, p.y - a.height / 4, a.width, a.height / 2+20);
+ }
+});
+
+Enemy.getOrCreateEnemy = function (arg) {
+ var selChild = null;
+ for (var j = 0; j < MW.CONTAINER.ENEMIES.length; j++) {
+ selChild = MW.CONTAINER.ENEMIES[j];
+
+ if (selChild.active == false && selChild.enemyType == arg.type) {
+ selChild.HP = arg.HP;
+ selChild.active = true;
+ selChild.moveType = arg.moveType;
+ selChild.scoreValue = arg.scoreValue;
+ selChild.attackMode = arg.attackMode;
+ selChild._hurtColorLife = 0;
+
+ selChild.schedule(selChild.shoot, selChild.delayTime);
+ selChild.setVisible(true);
+ MW.ACTIVE_ENEMIES++;
+ return selChild;
+ }
+ }
+ selChild = Enemy.create(arg);
+ MW.ACTIVE_ENEMIES++;
+ return selChild;
+};
+
+Enemy.create = function (arg) {
+ var enemy = new Enemy(arg);
+ g_sharedGameLayer.addEnemy(enemy, enemy.zOrder, MW.UNIT_TAG.ENEMY);
+ MW.CONTAINER.ENEMIES.push(enemy);
+ return enemy;
+};
+
+Enemy.preSet = function () {
+ var enemy = null;
+ for (var i = 0; i < 3; i++) {
+ for (var i = 0; i < EnemyType.length; i++) {
+ enemy = Enemy.create(EnemyType[i]);
+ enemy.setVisible(false);
+ enemy.active = false;
+ enemy.stopAllActions();
+ enemy.unscheduleAllCallbacks();
+ }
+ }
+};
\ No newline at end of file
diff --git a/games/MoonWarriors-Runtime/src/Explosion.js b/games/MoonWarriors-Runtime/src/Explosion.js
new file mode 100755
index 00000000..67485598
--- /dev/null
+++ b/games/MoonWarriors-Runtime/src/Explosion.js
@@ -0,0 +1,72 @@
+var Explosion = cc.Sprite.extend({
+ tmpWidth:0,
+ tmpHeight:0,
+ active:true,
+ animation:null,
+ ctor:function () {
+ this._super();
+
+ var pFrame = cc.SpriteFrameCache.getInstance().getSpriteFrame("explosion_01.png");
+ this.initWithSpriteFrame(pFrame);
+ this.setBlendFunc(gl.SRC_ALPHA, gl.ONE);
+
+ var cs = this.getContentSize();
+ this.tmpWidth = cs.width;
+ this.tmpHeight = cs.height;
+ this.animation = cc.AnimationCache.getInstance().getAnimation("Explosion");
+ },
+ play:function(){
+ //return;
+ this.runAction(cc.Sequence.create(
+ cc.Animate.create(this.animation),
+ cc.CallFunc.create(this.destroy, this)
+ ));
+ },
+ destroy:function () {
+ this.setVisible(false);
+ this.active = false;
+ }
+});
+
+Explosion.sharedExplosion = function () {
+ var animFrames = [];
+ var str = "";
+ for (var i = 1; i < 35; i++) {
+ str = "explosion_" + (i < 10 ? ("0" + i) : i) + ".png";
+ var frame = cc.SpriteFrameCache.getInstance().getSpriteFrame(str);
+ animFrames.push(frame);
+ }
+ var animation = cc.Animation.create(animFrames, 0.04);
+ cc.AnimationCache.getInstance().addAnimation(animation, "Explosion");
+};
+
+Explosion.getOrCreateExplosion = function () {
+ var selChild =null;
+ for (var j = 0; j < MW.CONTAINER.EXPLOSIONS.length; j++) {
+ var selChild = MW.CONTAINER.EXPLOSIONS[j];
+ if (selChild.active == false) {
+ selChild.setVisible(true);
+ selChild.active = true;
+ selChild.play();
+ return selChild;
+ }
+ }
+ selChild = Explosion.create();
+ selChild.play();
+ return selChild;
+};
+Explosion.create = function () {
+ var explosion = new Explosion();
+ g_sharedGameLayer.addExplosions(explosion);
+ MW.CONTAINER.EXPLOSIONS.push(explosion);
+ return explosion;
+};
+
+Explosion.preSet = function () {
+ var explosion = null;
+ for (var i = 0; i < 6; i++) {
+ explosion = Explosion.create();
+ explosion.setVisible(false);
+ explosion.active = false;
+ }
+};
diff --git a/games/MoonWarriors-Runtime/src/GameControlMenu.js b/games/MoonWarriors-Runtime/src/GameControlMenu.js
new file mode 100755
index 00000000..baf620b1
--- /dev/null
+++ b/games/MoonWarriors-Runtime/src/GameControlMenu.js
@@ -0,0 +1,32 @@
+var GameControlMenu = cc.Layer.extend({
+
+ init:function () {
+ var bRet = false;
+ if (this._super()) {
+ cc.MenuItemFont.setFontSize(18);
+ cc.MenuItemFont.setFontName("Arial");
+ var systemMenu = cc.MenuItemFont.create("Main Menu", this.onSysMenu);
+ var menu = cc.Menu.create(systemMenu);
+ menu.setPosition(0, 0);
+ systemMenu.setAnchorPoint(0, 0);
+ systemMenu.setPosition(winSize.width-95, 5);
+ this.addChild(menu, 1, 2);
+ bRet = true;
+ }
+
+ return bRet;
+ },
+ onSysMenu:function (pSender) {
+ var scene = cc.Scene.create();
+ scene.addChild(SysMenu.create());
+ cc.Director.getInstance().replaceScene(cc.TransitionFade.create(1.2,scene));
+ }
+});
+
+GameControlMenu.create = function () {
+ var sg = new GameControlMenu();
+ if (sg && sg.init()) {
+ return sg;
+ }
+ return null;
+};
diff --git a/games/MoonWarriors-Runtime/src/GameController.js b/games/MoonWarriors-Runtime/src/GameController.js
new file mode 100755
index 00000000..74ac3f12
--- /dev/null
+++ b/games/MoonWarriors-Runtime/src/GameController.js
@@ -0,0 +1,70 @@
+/**
+ * Cocos2d-html5 show case : Moon Warriors
+ *
+ * @Licensed:
+ * This showcase is licensed under GPL.
+ *
+ * @Authors:
+ * Programmer: Shengxiang Chen (陈升想), Dingping Lv (吕定平), Ricardo Quesada
+ * Effects animation: Hao Wu (吴昊)
+ * Quality Assurance: Sean Lin (林顺)
+ *
+ * @Links:
+ * http://www.cocos2d-x.org
+ * http://bbs.html5china.com
+ *
+ */
+
+
+MW.GameController = cc.Class.extend({
+ _curScene:null,
+ _gameState:MW.GAME_STATE.HOME,
+ _isNewGame:true,
+ _curLevel:MW.LEVEL.STAGE1,
+ _selectLevel:MW.LEVEL.STAGE1,
+ init:function () {
+ return true;
+ },
+ setCurScene:function (s) {
+ if (this._curScene != s) {
+ if (this._curScene !== null) {
+ this._curScene.onExit();
+ }
+ this._curScene = s;
+ if (this._curScene) {
+ this._curScene.onEnter();
+ cc.Director.getInstance().replaceScene(s);
+ }
+ }
+ },
+ getCurScene:function () {
+ return this._curScene;
+ },
+ runGame:function () {
+
+ },
+ newGame:function () {
+
+ },
+ option:function () {
+
+ },
+ about:function () {
+
+ }
+});
+
+MW.GameController.getInstance = function () {
+ cc.Assert(this._sharedGame, "Havn't call setSharedGame");
+ if (!this._sharedGame) {
+ this._sharedGame = new MW.GameController();
+ if (this._sharedGame.init()) {
+ return this._sharedGame;
+ }
+ } else {
+ return this._sharedGame;
+ }
+ return null;
+};
+
+MW.GameController._sharedGame = null;
diff --git a/games/MoonWarriors-Runtime/src/GameLayer.js b/games/MoonWarriors-Runtime/src/GameLayer.js
new file mode 100755
index 00000000..c627c654
--- /dev/null
+++ b/games/MoonWarriors-Runtime/src/GameLayer.js
@@ -0,0 +1,351 @@
+//
+// MoonWarriors
+//
+// Handles the Game Logic
+//
+
+STATE_PLAYING = 0;
+STATE_GAMEOVER = 1;
+MAX_CONTAINT_WIDTH = 40;
+MAX_CONTAINT_HEIGHT = 40;
+
+var g_sharedGameLayer;
+
+var GameLayer = cc.Layer.extend({
+ _time:null,
+ _ship:null,
+ _backSky:null,
+ _backSkyHeight:0,
+ _backSkyRe:null,
+ _levelManager:null,
+ _tmpScore:0,
+ _isBackSkyReload:false,
+ _isBackTileReload:false,
+ lbScore:null,
+ screenRect:null,
+ explosionAnimation:[],
+ _beginPos:cc.p(0, 0),
+ _state:STATE_PLAYING,
+ _explosions:null,
+ _texOpaqueBatch:null,
+ _texTransparentBatch:null,
+
+ init:function () {
+ var bRet = false;
+ if (this._super()) {
+ cc.SpriteFrameCache.getInstance().addSpriteFrames(res.textureOpaquePack_plist);
+ cc.SpriteFrameCache.getInstance().addSpriteFrames(res.b01_plist);
+
+ // reset global values
+ MW.CONTAINER.ENEMIES = [];
+ MW.CONTAINER.ENEMY_BULLETS = [];
+ MW.CONTAINER.PLAYER_BULLETS = [];
+ MW.CONTAINER.EXPLOSIONS = [];
+ MW.CONTAINER.SPARKS = [];
+ MW.CONTAINER.HITS = [];
+ MW.CONTAINER.BACKSKYS = [];
+ MW.CONTAINER.BACKTILEMAPS = [];
+ MW.ACTIVE_ENEMIES = 0;
+
+ MW.SCORE = 0;
+ MW.LIFE = 4;
+ this._state = STATE_PLAYING;
+
+ // OpaqueBatch
+ var texOpaque = cc.TextureCache.getInstance().addImage(res.textureOpaquePack_png);
+ this._texOpaqueBatch = cc.SpriteBatchNode.createWithTexture(texOpaque);
+ this._texOpaqueBatch.setBlendFunc(gl.SRC_ALPHA, gl.ONE);
+ this.addChild(this._texOpaqueBatch);
+
+ // TransparentBatch
+ var texTransparent = cc.TextureCache.getInstance().addImage(res.textureTransparentPack_png);
+ this._texTransparentBatch = cc.SpriteBatchNode.createWithTexture(texTransparent);
+ this.addChild(this._texTransparentBatch);
+
+ winSize = cc.Director.getInstance().getWinSize();
+ this._levelManager = new LevelManager(this);
+
+ this.screenRect = cc.rect(0, 0, winSize.width, winSize.height + 10);
+
+ // score
+ this.lbScore = cc.LabelBMFont.create("Score: 0", res.arial_14_fnt);
+ this.lbScore.setAnchorPoint(1, 0);
+ this.lbScore.setAlignment(cc.TEXT_ALIGNMENT_RIGHT);
+ this.addChild(this.lbScore, 1000);
+ this.lbScore.setPosition(winSize.width - 5, winSize.height - 30);
+
+ // ship life
+ var life = cc.Sprite.createWithSpriteFrameName("ship01.png");
+ life.setScale(0.6);
+ life.setPosition(30, 460);
+ this._texTransparentBatch.addChild(life, 1, 5);
+
+ // ship Life count
+ this._lbLife = cc.LabelTTF.create("0", "Arial", 20);
+ this._lbLife.setPosition(60, 463);
+ this._lbLife.setColor(cc.c3b(255, 0, 0));
+ this.addChild(this._lbLife, 1000);
+
+ // ship
+ this._ship = new Ship();
+ this._texTransparentBatch.addChild(this._ship, this._ship.zOrder, MW.UNIT_TAG.PLAYER);
+
+ // explosion batch node
+ cc.SpriteFrameCache.getInstance().addSpriteFrames(res.explosion_plist);
+ var explosionTexture = cc.TextureCache.getInstance().addImage(res.explosion_png);
+ this._explosions = cc.SpriteBatchNode.createWithTexture(explosionTexture);
+ this._explosions.setBlendFunc(gl.SRC_ALPHA, gl.ONE);
+ this.addChild(this._explosions);
+ Explosion.sharedExplosion();
+
+ // accept touch now!
+
+ if (sys.capabilities.hasOwnProperty('keyboard'))
+ this.setKeyboardEnabled(true);
+
+ if (sys.capabilities.hasOwnProperty('mouse'))
+ /*if ('mouse' in sys.capabilities)*/
+ this.setMouseEnabled(true);
+
+ if (sys.capabilities.hasOwnProperty('touches'))
+ /*if ('touches' in sys.capabilities)*/
+ this.setTouchEnabled(true);
+
+ // schedule
+ this.scheduleUpdate();
+ this.schedule(this.scoreCounter, 1);
+
+ if (MW.SOUND) {
+ cc.AudioEngine.getInstance().playMusic(res.bgMusic_mp3, true);
+ }
+
+ bRet = true;
+
+ g_sharedGameLayer = this;
+
+ //pre set
+ Bullet.preSet();
+ Enemy.preSet();
+ HitEffect.preSet();
+ SparkEffect.preSet();
+ Explosion.preSet();
+ BackSky.preSet();
+ BackTileMap.preSet();
+
+ this.initBackground();
+ }
+ return bRet;
+ },
+
+ scoreCounter:function () {
+ if (this._state == STATE_PLAYING) {
+ this._time++;
+ this._levelManager.loadLevelResource(this._time);
+ }
+ },
+
+ onTouchesMoved:function (touches, event) {
+ this.processEvent(touches[0]);
+ },
+
+ onMouseDragged:function (event) {
+ this.processEvent(event);
+ },
+
+ processEvent:function (event) {
+ if (this._state == STATE_PLAYING) {
+ var delta = event.getDelta();
+ var curPos = this._ship.getPosition();
+ curPos = cc.pAdd(curPos, delta);
+ curPos = cc.pClamp(curPos, cc.POINT_ZERO, cc.p(winSize.width, winSize.height));
+ this._ship.setPosition(curPos);
+ }
+ },
+
+ onKeyDown:function (e) {
+ MW.KEYS[e] = true;
+ },
+
+ onKeyUp:function (e) {
+ MW.KEYS[e] = false;
+ },
+ update:function (dt) {
+ if (this._state == STATE_PLAYING) {
+ this.checkIsCollide();
+ this.removeInactiveUnit(dt);
+ this.checkIsReborn();
+ this.updateUI();
+ this._movingBackground(dt);
+ }
+ },
+ checkIsCollide:function () {
+ var selChild, bulletChild;
+ // check collide
+ var i, locShip =this._ship;
+ for (i = 0; i < MW.CONTAINER.ENEMIES.length; i++) {
+ selChild = MW.CONTAINER.ENEMIES[i];
+ if (!selChild.active)
+ continue;
+
+ for (var j = 0; j < MW.CONTAINER.PLAYER_BULLETS.length; j++) {
+ bulletChild = MW.CONTAINER.PLAYER_BULLETS[j];
+ if (bulletChild.active && this.collide(selChild, bulletChild)) {
+ bulletChild.hurt();
+ selChild.hurt();
+ }
+ }
+ if (this.collide(selChild, locShip)) {
+ if (locShip.active) {
+ selChild.hurt();
+ locShip.hurt();
+ }
+ }
+ }
+
+ for (i = 0; i < MW.CONTAINER.ENEMY_BULLETS.length; i++) {
+ selChild = MW.CONTAINER.ENEMY_BULLETS[i];
+ if (selChild.active && this.collide(selChild, locShip)) {
+ if (locShip.active) {
+ selChild.hurt();
+ locShip.hurt();
+ }
+ }
+ }
+ },
+ removeInactiveUnit:function (dt) {
+ var selChild, children = this._texOpaqueBatch.getChildren();
+ for (var i in children) {
+ selChild = children[i];
+ if (selChild && selChild.active)
+ selChild.update(dt);
+ }
+
+ children = this._texTransparentBatch.getChildren();
+ for (i in children) {
+ selChild = children[i];
+ if (selChild && selChild.active)
+ selChild.update(dt);
+ }
+ },
+ checkIsReborn:function () {
+ var locShip = this._ship;
+ if (MW.LIFE > 0 && !locShip.active) {
+ locShip.born();
+ } else if (MW.LIFE <= 0 && !locShip.active) {
+ this._state = STATE_GAMEOVER;
+ // XXX: needed for JS bindings.
+ this._ship = null;
+ this.runAction(cc.Sequence.create(
+ cc.DelayTime.create(0.2),
+ cc.CallFunc.create(this.onGameOver, this)));
+ }
+ },
+ updateUI:function () {
+ if (this._tmpScore < MW.SCORE) {
+ this._tmpScore += 1;
+ }
+ this._lbLife.setString(MW.LIFE + '');
+ this.lbScore.setString("Score: " + this._tmpScore);
+ },
+ collide:function (a, b) {
+ var pos1 = a.getPosition();
+ var pos2 = b.getPosition();
+ if (Math.abs(pos1.x - pos2.x) > MAX_CONTAINT_WIDTH || Math.abs(pos1.y - pos2.y) > MAX_CONTAINT_HEIGHT)
+ return false;
+
+ var aRect = a.collideRect(pos1);
+ var bRect = b.collideRect(pos2);
+ return cc.rectIntersectsRect(aRect, bRect);
+ },
+ initBackground:function () {
+ this._backSky = BackSky.getOrCreate();
+ this._backSkyHeight = this._backSky.getContentSize().height;
+
+ this.moveTileMap();
+ this.schedule(this.moveTileMap, 5);
+ },
+ moveTileMap:function () {
+ var backTileMap = BackTileMap.getOrCreate();
+ var ran = Math.random();
+ backTileMap.setPosition(ran * 320, winSize.height);
+ var move = cc.MoveBy.create(ran * 2 + 10, cc.p(0, -winSize.height-240));
+ var fun =cc.CallFunc.create(function(){
+ backTileMap.destroy();
+ },this);
+ backTileMap.runAction(cc.Sequence.create(move,fun));
+ },
+
+ _movingBackground:function(dt){
+ var movingDist = 16 * dt; // background's moving rate is 16 pixel per second
+
+ var locSkyHeight = this._backSkyHeight, locBackSky = this._backSky;
+ var currPosY = locBackSky.getPositionY() - movingDist;
+ var locBackSkyRe = this._backSkyRe;
+
+ if(locSkyHeight + currPosY <= winSize.height){
+ if(locBackSkyRe != null)
+ throw "The memory is leaking at moving background";
+ locBackSkyRe = this._backSky;
+ this._backSkyRe = this._backSky;
+
+ //create a new background
+ this._backSky = BackSky.getOrCreate();
+ locBackSky = this._backSky;
+ locBackSky.setPositionY(currPosY + locSkyHeight - 2);
+ } else
+ locBackSky.setPositionY(currPosY);
+
+ if(locBackSkyRe){
+ //locBackSkyRe
+ currPosY = locBackSkyRe.getPositionY() - movingDist;
+ if(currPosY + locSkyHeight < 0){
+ locBackSkyRe.destroy();
+ this._backSkyRe = null;
+ } else
+ locBackSkyRe.setPositionY(currPosY);
+ }
+ },
+
+ onGameOver:function () {
+ Moon.preload(["gameover"], function (isSucces) {
+ var scene = cc.Scene.create();
+ scene.addChild(GameOver.create());
+ cc.Director.getInstance().replaceScene(cc.TransitionFade.create(1.2, scene));
+ }, this);
+ }
+});
+
+GameLayer.create = function () {
+ var sg = new GameLayer();
+ if (sg && sg.init()) {
+ return sg;
+ }
+ return null;
+};
+
+GameLayer.scene = function () {
+ var scene = cc.Scene.create();
+ var layer = GameLayer.create();
+ scene.addChild(layer, 1);
+ return scene;
+};
+
+GameLayer.prototype.addEnemy = function (enemy, z, tag) {
+ this._texTransparentBatch.addChild(enemy, z, tag);
+};
+
+GameLayer.prototype.addExplosions = function (explosion) {
+ this._explosions.addChild(explosion);
+};
+
+GameLayer.prototype.addBulletHits = function (hit, zOrder) {
+ this._texOpaqueBatch.addChild(hit, zOrder);
+};
+
+GameLayer.prototype.addSpark = function (spark) {
+ this._texOpaqueBatch.addChild(spark);
+};
+
+GameLayer.prototype.addBullet = function (bullet, zOrder, mode) {
+ this._texOpaqueBatch.addChild(bullet, zOrder, mode);
+};
diff --git a/games/MoonWarriors-Runtime/src/GameOver.js b/games/MoonWarriors-Runtime/src/GameOver.js
new file mode 100755
index 00000000..4669e66a
--- /dev/null
+++ b/games/MoonWarriors-Runtime/src/GameOver.js
@@ -0,0 +1,84 @@
+var GameOver = cc.Layer.extend({
+ _ship:null,
+ _lbScore:0,
+
+ init:function () {
+ var bRet = false;
+ this.setKeypadEnabled(true);
+ if (this._super()) {
+ var sp = cc.Sprite.create(res.loading_png);
+ sp.setAnchorPoint(0,0);
+ this.addChild(sp, 0, 1);
+
+ var logo = cc.Sprite.create(res.gameOver_png);
+ logo.setAnchorPoint(0,0);
+ logo.setPosition(0,300);
+ this.addChild(logo,10,1);
+
+ var playAgainNormal = cc.Sprite.create(res.menu_png, cc.rect(378, 0, 126, 33));
+ var playAgainSelected = cc.Sprite.create(res.menu_png, cc.rect(378, 33, 126, 33));
+ var playAgainDisabled = cc.Sprite.create(res.menu_png, cc.rect(378, 33 * 2, 126, 33));
+
+ var cocos2dhtml5 = cc.Sprite.create(res.cocos2d_html5_png);
+ cocos2dhtml5.setPosition(160,150);
+ this.addChild(cocos2dhtml5,10);
+ var flare = cc.Sprite.create(res.flare_jpg);
+ this.addChild(flare);
+ flare.setVisible(false);
+ var playAgain = cc.MenuItemSprite.create(playAgainNormal, playAgainSelected, playAgainDisabled, function(){
+ flareEffect(flare,this,this.onPlayAgain);
+ }.bind(this) );
+
+ var menu = cc.Menu.create(playAgain);
+ this.addChild(menu, 1, 2);
+ menu.setPosition(winSize.width / 2, 220);
+
+ var lbScore = cc.LabelTTF.create("Your Score:"+MW.SCORE,"Arial Bold",16);
+ lbScore.setPosition(160,280);
+ lbScore.setColor(cc.c3b(250,179,0));
+ this.addChild(lbScore,10);
+
+ var b1 = cc.LabelTTF.create("Download Cocos2d-html5","Arial",14);
+ var b2 = cc.LabelTTF.create("Download This Sample","Arial",14);
+ var menu1 = cc.MenuItemLabel.create(b1,function(){
+ window.location.href = "http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Cocos2d-html5";
+ });
+ var menu2 = cc.MenuItemLabel.create(b2,function(){
+ window.location.href = "https://github.com/ShengxiangChen/MoonWarriors";
+ });
+ var cocos2dMenu = cc.Menu.create(menu1,menu2);
+ cocos2dMenu.alignItemsVerticallyWithPadding(10);
+ cocos2dMenu.setPosition(160,80);
+ this.addChild(cocos2dMenu);
+
+
+ if(MW.SOUND){
+ cc.AudioEngine.getInstance().playMusic(res.mainMainMusic_mp3);
+ }
+
+ bRet = true;
+ }
+ return bRet;
+ },
+ onPlayAgain:function (pSender) {
+ var scene = cc.Scene.create();
+ scene.addChild(GameLayer.create());
+ scene.addChild(GameControlMenu.create());
+ cc.Director.getInstance().replaceScene(cc.TransitionFade.create(1.2,scene));
+ }
+});
+
+GameOver.create = function () {
+ var sg = new GameOver();
+ if (sg && sg.init()) {
+ return sg;
+ }
+ return null;
+};
+
+GameOver.scene = function () {
+ var scene = cc.Scene.create();
+ var layer = GameOver.create();
+ scene.addChild(layer);
+ return scene;
+};
diff --git a/games/MoonWarriors-Runtime/src/HitEffect.js b/games/MoonWarriors-Runtime/src/HitEffect.js
new file mode 100755
index 00000000..4e6f92f4
--- /dev/null
+++ b/games/MoonWarriors-Runtime/src/HitEffect.js
@@ -0,0 +1,52 @@
+var HitEffect = cc.Sprite.extend({
+ active:true,
+ ctor:function () {
+ this._super();
+
+ this.initWithSpriteFrameName("hit.png");
+ this.setBlendFunc(gl.SRC_ALPHA, gl.ONE);
+ },
+ reset:function (pos, rotation, scale) {
+ this.setPosition(pos);
+ this.setRotation(rotation);
+ this.setScale(scale);
+ this.runAction(cc.ScaleBy.create(0.3, 2, 2));
+ this.runAction(cc.Sequence.create(cc.FadeOut.create(0.3), cc.CallFunc.create(this.destroy, this)));
+ },
+ destroy:function () {
+ this.setVisible(false);
+ this.active = false;
+ }
+});
+
+HitEffect.getOrCreateHitEffect = function (pos, rotation, scale) {
+ var selChild = null;
+ for (var j = 0; j < MW.CONTAINER.HITS.length; j++) {
+ selChild = MW.CONTAINER.HITS[j];
+ if (selChild.active == false) {
+ selChild.setVisible(true);
+ selChild.active = true;
+ selChild.reset(pos, rotation, scale);
+ return selChild;
+ }
+ }
+ selChild = HitEffect.create(pos, rotation, scale);
+ selChild.reset(pos, rotation, scale);
+ return selChild;
+};
+
+HitEffect.create = function () {
+ var hitEffect = new HitEffect();
+ g_sharedGameLayer.addBulletHits(hitEffect, 9999);
+ MW.CONTAINER.HITS.push(hitEffect);
+ return hitEffect;
+};
+
+HitEffect.preSet = function () {
+ var hitEffect = null;
+ for (var i = 0; i < 10; i++) {
+ hitEffect = HitEffect.create();
+ hitEffect.setVisible(false);
+ hitEffect.active = false;
+ }
+};
diff --git a/games/MoonWarriors-Runtime/src/LevelManager.js b/games/MoonWarriors-Runtime/src/LevelManager.js
new file mode 100755
index 00000000..53ec28d7
--- /dev/null
+++ b/games/MoonWarriors-Runtime/src/LevelManager.js
@@ -0,0 +1,99 @@
+var LevelManager = cc.Class.extend({
+ _currentLevel:null,
+ _gameLayer:null,
+ ctor:function(gameLayer){
+ if(!gameLayer){
+ throw "gameLayer must be non-nil";
+ }
+ this._currentLevel = Level1;
+ this._gameLayer = gameLayer;
+ this.setLevel(this._currentLevel);
+ },
+
+ setLevel:function(level){
+ var locCurrentLevelEnemies = this._currentLevel.enemies;
+ for(var i = 0; i< level.enemies.length; i++)
+ locCurrentLevelEnemies[i].ShowTime = this._minuteToSecond(locCurrentLevelEnemies[i].ShowTime);
+ },
+ _minuteToSecond:function(minuteStr){
+ if(!minuteStr)
+ return 0;
+ if(typeof(minuteStr) != "number"){
+ var mins = minuteStr.split(':');
+ if(mins.length == 1){
+ return parseInt(mins[0],10);
+ }else {
+ return parseInt(mins[0],10 )* 60 + parseInt(mins[1],10);
+ }
+ }
+ return minuteStr;
+ },
+
+ loadLevelResource:function(deltaTime){
+ if(MW.ACTIVE_ENEMIES>= this._currentLevel.enemyMax){
+ return;
+ }
+ //load enemy
+ var locCurrentLevel = this._currentLevel;
+ for(var i = 0; i< locCurrentLevel.enemies.length; i++){
+ var selEnemy = locCurrentLevel.enemies[i];
+ if(selEnemy){
+ if(selEnemy.ShowType === "Once"){
+ if(selEnemy.ShowTime == deltaTime){
+ for(var tIndex = 0; tIndex < selEnemy.Types.length;tIndex++ ){
+ this.addEnemyToGameLayer(selEnemy.Types[tIndex]);
+ }
+ }
+ }else if(selEnemy.ShowType === "Repeate"){
+ if(deltaTime % selEnemy.ShowTime === 0){
+ for(var rIndex = 0; rIndex < selEnemy.Types.length;rIndex++ ){
+ this.addEnemyToGameLayer(selEnemy.Types[rIndex]);
+ }
+ }
+ }
+ }
+ }
+ },
+
+ addEnemyToGameLayer:function(enemyType){
+ var addEnemy = Enemy.getOrCreateEnemy(EnemyType[enemyType]);
+ var enemypos = cc.p( 80 + (winSize.width - 160) * Math.random(), winSize.height);
+ var enemycs = addEnemy.getContentSize();
+ addEnemy.setPosition( enemypos );
+
+ var offset, tmpAction;
+ var a0=0;
+ var a1=0;
+ switch (addEnemy.moveType) {
+ case MW.ENEMY_MOVE_TYPE.ATTACK:
+ offset = this._gameLayer._ship.getPosition();
+ tmpAction = cc.MoveTo.create(1, offset);
+ break;
+ case MW.ENEMY_MOVE_TYPE.VERTICAL:
+ offset = cc.p(0, -winSize.height - enemycs.height);
+ tmpAction = cc.MoveBy.create(4, offset);
+ break;
+ case MW.ENEMY_MOVE_TYPE.HORIZONTAL:
+ offset = cc.p(0, -100 - 200 * Math.random());
+ a0 = cc.MoveBy.create(0.5, offset);
+ a1 = cc.MoveBy.create(1, cc.p(-50 - 100 * Math.random(), 0));
+ var onComplete = cc.CallFunc.create(function (pSender) {
+ var a2 = cc.DelayTime.create(1);
+ var a3 = cc.MoveBy.create(1, cc.p(100 + 100 * Math.random(), 0));
+ pSender.runAction(cc.RepeatForever.create(
+ cc.Sequence.create(a2, a3, a2.clone(), a3.reverse())
+ ));
+ }.bind(addEnemy) );
+ tmpAction = cc.Sequence.create(a0, a1, onComplete);
+ break;
+ case MW.ENEMY_MOVE_TYPE.OVERLAP:
+ var newX = (enemypos.x <= winSize.width / 2) ? 320 : -320;
+ a0 = cc.MoveBy.create(4, cc.p(newX, -240));
+ a1 = cc.MoveBy.create(4,cc.p(-newX,-320));
+ tmpAction = cc.Sequence.create(a0,a1);
+ break;
+ }
+
+ addEnemy.runAction(tmpAction);
+ }
+});
diff --git a/games/MoonWarriors-Runtime/src/Resource.js b/games/MoonWarriors-Runtime/src/Resource.js
new file mode 100755
index 00000000..0a158975
--- /dev/null
+++ b/games/MoonWarriors-Runtime/src/Resource.js
@@ -0,0 +1,130 @@
+var res = {
+ bgMusic_mp3: 'res/Music/bgMusic.mp3',
+ bgMusic_ogg: 'res/Music/bgMusic.ogg',
+ buttonEffet_mp3: 'res/Music/buttonEffet.mp3',
+ buttonEffet_ogg: 'res/Music/buttonEffet.ogg',
+ explodeEffect_mp3: 'res/Music/explodeEffect.mp3',
+ explodeEffect_ogg: 'res/Music/explodeEffect.ogg',
+ fireEffect_mp3: 'res/Music/fireEffect.mp3', //unused
+ fireEffect_ogg: 'res/Music/fireEffect.ogg', //unused
+ mainMainMusic_mp3: 'res/Music/mainMainMusic.mp3',
+ mainMainMusic_ogg: 'res/Music/mainMainMusic.ogg',
+ shipDestroyEffect_mp3: 'res/Music/shipDestroyEffect.mp3',
+ shipDestroyEffect_ogg: 'res/Music/shipDestroyEffect.ogg',
+ arial_14_fnt: 'res/arial-14.fnt',
+ arial_14_png: 'res/arial-14.png',
+ b01_plist: 'res/b01.plist',
+ b01_png: 'res/b01.png',
+ cocos2d_html5_png: 'res/cocos2d-html5.png',
+ explode_plist: 'res/explode.plist', //unused
+ explosion_plist: 'res/explosion.plist',
+ explosion_png: 'res/explosion.png',
+ flare_jpg: 'res/flare.jpg',
+ gameOver_png: 'res/gameOver.png',
+ level01_tmx: 'res/level01.tmx',
+ loading_png: 'res/loading.png',
+ logo_png: 'res/logo.png',
+ menu_png: 'res/menu.png',
+ menuTitle_png: 'res/menuTitle.png',
+ textureOpaquePack_plist: 'res/textureOpaquePack.plist',
+ textureOpaquePack_png: 'res/textureOpaquePack.png',
+ textureTransparentPack_plist: 'res/textureTransparentPack.plist',
+ textureTransparentPack_png: 'res/textureTransparentPack.png',
+ //loading
+ glow_png: 'res_engine/progress_light.png',
+ preload_logo_png: 'res_engine/preload_logo.png',
+ preload_title_png: 'res_engine/preload_title.png',
+ preload_bg_jpg: 'res_engine/preload_bg.jpg',
+ progress_bar_png: 'res_engine/progress_bar.png',
+ progress_bg_png: 'res_engine/progress_bg.png',
+ progress_shadow_png: 'res_engine/progress_shadow.png',
+
+ dialog_bg_png:"res_engine/dialog_bg.png",
+ dialog_cancel_normal_png:"res_engine/dialog_cancel_normal.png",
+ dialog_cancel_press_png:"res_engine/dialog_cancel_press.png",
+ dialog_confirm_normal_png:"res_engine/dialog_confirm_normal.png",
+ dialog_confirm_press_png:"res_engine/dialog_confirm_press.png",
+
+ network_dialog_bg_png:"res/dialog_bg.png",
+ network_dialog_cancel_normal_png:"res/dialog_cancel_normal.png",
+ network_dialog_cancel_press_png:"res/dialog_cancel_press.png",
+ network_dialog_confirm_normal_png:"res/dialog_confirm_normal.png",
+ network_dialog_confirm_press_png:"res/dialog_confirm_press.png"
+};
+
+
+window["preloadPage"] = [
+ {src: res.glow_png},
+ {src: res.preload_logo_png},
+ {src: res.preload_title_png},
+ {src: res.preload_bg_jpg},
+ {src: res.progress_bar_png},
+ {src: res.progress_bg_png},
+ {src: res.progress_shadow_png},
+
+ {src: res.dialog_bg_png},
+ {src: res.dialog_cancel_normal_png},
+ {src: res.dialog_cancel_press_png},
+ {src: res.dialog_confirm_normal_png},
+ {src: res.dialog_confirm_press_png},
+
+ {src: res.network_dialog_bg_png},
+ {src: res.network_dialog_cancel_normal_png},
+ {src: res.network_dialog_cancel_press_png},
+ {src: res.network_dialog_confirm_normal_png},
+ {src: res.network_dialog_confirm_press_png}
+];
+
+window["boot"] = [
+ {src: res.loading_png},
+ {src: res.flare_jpg},
+ {src: res.menu_png},
+ {src: res.logo_png},
+ {src: res.mainMainMusic_mp3},
+ {src: res.mainMainMusic_ogg},
+
+ {src: res.textureTransparentPack_plist},
+ {src: res.textureTransparentPack_png}
+];
+
+window["common"] = [
+ {src: res.menuTitle_png}
+];
+
+window["gamelayer"] = [
+ //image
+ {src: res.arial_14_png},
+ {src: res.explosion_png},
+ {src: res.textureOpaquePack_png},
+ {src: res.b01_png},
+ {src: res.b01_plist},
+ //tmx
+ //{src:res.level01_tmx},
+
+ //plist
+ {src: res.explosion_plist},
+ {src: res.textureOpaquePack_plist},
+
+ //music
+ {src: res.bgMusic_mp3},
+ {src: res.bgMusic_ogg},
+
+ //effect
+ {src: res.buttonEffet_mp3},
+ {src: res.explodeEffect_mp3},
+ {src: res.fireEffect_mp3},
+ {src: res.shipDestroyEffect_mp3},
+ {src: res.buttonEffet_ogg},
+ {src: res.explodeEffect_ogg},
+ {src: res.fireEffect_ogg},
+ {src: res.shipDestroyEffect_ogg},
+
+ // FNT
+ {src: res.arial_14_fnt}
+];
+
+window["gameover"] = [
+ res.cocos2d_html5_png,
+ res.gameOver_png
+];
+
diff --git a/games/MoonWarriors-Runtime/src/SettingsLayer.js b/games/MoonWarriors-Runtime/src/SettingsLayer.js
new file mode 100755
index 00000000..69c70a0f
--- /dev/null
+++ b/games/MoonWarriors-Runtime/src/SettingsLayer.js
@@ -0,0 +1,86 @@
+var SettingsLayer = cc.Layer.extend({
+ init:function () {
+ var bRet = false;
+ if (this._super()) {
+ var sp = cc.Sprite.create(res.loading_png);
+ sp.setAnchorPoint(0,0);
+ this.addChild(sp, 0, 1);
+
+ var cacheImage = cc.TextureCache.getInstance().addImage(res.menuTitle_png);
+ var title = cc.Sprite.createWithTexture(cacheImage, cc.rect(0, 0, 134, 34));
+ title.setPosition(winSize.width / 2, winSize.height - 120);
+ this.addChild(title);
+
+
+ cc.MenuItemFont.setFontName("Arial");
+ cc.MenuItemFont.setFontSize(18);
+ var title1 = cc.MenuItemFont.create("Sound");
+ title1.setEnabled(false);
+
+ cc.MenuItemFont.setFontName("Arial");
+ cc.MenuItemFont.setFontSize(26);
+ var item1 = cc.MenuItemToggle.create(
+ cc.MenuItemFont.create("On"),
+ cc.MenuItemFont.create("Off") );
+ item1.setCallback(this.onSoundControl );
+ var state = MW.SOUND ? 0 : 1;
+ item1.setSelectedIndex(state);
+
+ cc.MenuItemFont.setFontName("Arial");
+ cc.MenuItemFont.setFontSize(18);
+ var title2 = cc.MenuItemFont.create("Mode");
+ title2.setEnabled(false);
+
+ cc.MenuItemFont.setFontName("Arial");
+ cc.MenuItemFont.setFontSize(26);
+ var item2 = cc.MenuItemToggle.create(
+ cc.MenuItemFont.create("Easy"),
+ cc.MenuItemFont.create("Normal"),
+ cc.MenuItemFont.create("Hard"));
+ item2.setCallback( this.onModeControl );
+
+
+ cc.MenuItemFont.setFontName("Arial");
+ cc.MenuItemFont.setFontSize(26);
+ var label = cc.LabelTTF.create("Go back", "Arial", 20);
+ var back = cc.MenuItemLabel.create(label, this.onBackCallback);
+ back.setScale(0.8);
+
+ var menu = cc.Menu.create(title1, title2, item1, item2, back);
+ menu.alignItemsInColumns(2, 2, 1);
+ this.addChild(menu);
+
+ back.setPositionY(back.getPositionY() - 50);
+
+ bRet = true;
+ }
+
+ return bRet;
+ },
+
+ onBackCallback:function (pSender) {
+ var scene = cc.Scene.create();
+ scene.addChild(SysMenu.create());
+ cc.Director.getInstance().replaceScene(cc.TransitionFade.create(1.2, scene));
+ },
+ onSoundControl:function(){
+ MW.SOUND = !MW.SOUND;
+ var audioEngine = cc.AudioEngine.getInstance();
+ if(MW.SOUND){
+ audioEngine.playMusic(res.mainMainMusic_mp3);
+ }
+ else{
+ audioEngine.stopMusic();
+ }
+ },
+ onModeControl:function(){
+ }
+});
+
+SettingsLayer.create = function () {
+ var sg = new SettingsLayer();
+ if (sg && sg.init()) {
+ return sg;
+ }
+ return null;
+};
diff --git a/games/MoonWarriors-Runtime/src/Ship.js b/games/MoonWarriors-Runtime/src/Ship.js
new file mode 100755
index 00000000..05a89666
--- /dev/null
+++ b/games/MoonWarriors-Runtime/src/Ship.js
@@ -0,0 +1,128 @@
+var Ship = cc.Sprite.extend({
+ speed:220,
+ bulletSpeed:MW.BULLET_SPEED.SHIP,
+ HP:5,
+ bulletTypeValue:1,
+ bulletPowerValue:1,
+ throwBombing:false,
+ canBeAttack:true,
+ isThrowingBomb:false,
+ zOrder:3000,
+ maxBulletPowerValue:4,
+ appearPosition:cc.p(160, 60),
+ _hurtColorLife:0,
+ active:true,
+ bornSprite:null,
+ ctor:function () {
+ this._super();
+
+ //init life
+ this.initWithSpriteFrameName("ship01.png");
+ this.setTag(this.zOrder);
+ this.setPosition(this.appearPosition);
+
+ // set frame
+ var frame0 = cc.SpriteFrameCache.getInstance().getSpriteFrame("ship01.png");
+ var frame1 = cc.SpriteFrameCache.getInstance().getSpriteFrame("ship02.png");
+
+ var animFrames = [];
+ animFrames.push(frame0);
+ animFrames.push(frame1);
+
+ // ship animate
+ var animation = cc.Animation.create(animFrames, 0.1);
+ var animate = cc.Animate.create(animation);
+ this.runAction(cc.RepeatForever.create(animate));
+ this.schedule(this.shoot, 1 / 6);
+
+ this.initBornSprite();
+ this.born();
+ },
+ update:function (dt) {
+ // Keys are only enabled on the browser
+ if (sys.platform == 'browser') {
+ var pos = this.getPosition();
+ if ((MW.KEYS[cc.KEY.w] || MW.KEYS[cc.KEY.up]) && pos.y <= winSize.height) {
+ pos.y += dt * this.speed;
+ }
+ if ((MW.KEYS[cc.KEY.s] || MW.KEYS[cc.KEY.down]) && pos.y >= 0) {
+ pos.y -= dt * this.speed;
+ }
+ if ((MW.KEYS[cc.KEY.a] || MW.KEYS[cc.KEY.left]) && pos.x >= 0) {
+ pos.x -= dt * this.speed;
+ }
+ if ((MW.KEYS[cc.KEY.d] || MW.KEYS[cc.KEY.right]) && pos.x <= winSize.width) {
+ pos.x += dt * this.speed;
+ }
+ this.setPosition(pos);
+ }
+
+ if (this.HP <= 0) {
+ this.active = false;
+ this.destroy();
+ }
+ this._timeTick += dt;
+ if (this._timeTick > 0.1) {
+ this._timeTick = 0;
+ if (this._hurtColorLife > 0) {
+ this._hurtColorLife--;
+ }
+ }
+ },
+ shoot:function (dt) {
+ //this.shootEffect();
+ var offset = 13;
+ var p = this.getPosition();
+ var cs = this.getContentSize();
+ var a = Bullet.getOrCreateBullet(this.bulletSpeed, "W1.png", MW.ENEMY_ATTACK_MODE.NORMAL, 3000, MW.UNIT_TAG.PLAYER_BULLET);
+ a.setPosition(p.x + offset, p.y + 3 + cs.height * 0.3);
+
+ var b = Bullet.getOrCreateBullet(this.bulletSpeed, "W1.png", MW.ENEMY_ATTACK_MODE.NORMAL, 3000, MW.UNIT_TAG.PLAYER_BULLET);
+ b.setPosition(p.x - offset, p.y + 3 + cs.height * 0.3);
+ },
+ destroy:function () {
+ MW.LIFE--;
+
+ var explosion = Explosion.getOrCreateExplosion();
+ explosion.setPosition(this.getPosition());
+
+ if (MW.SOUND) {
+ cc.AudioEngine.getInstance().playEffect(res.shipDestroyEffect_mp3);
+ }
+ },
+ hurt:function () {
+ if (this.canBeAttack) {
+ this._hurtColorLife = 2;
+ this.HP--;
+ }
+ },
+ collideRect:function (p) {
+ var a = this.getContentSize();
+ return cc.rect(p.x - a.width / 2, p.y - a.height / 2, a.width, a.height / 2);
+ },
+ initBornSprite:function () {
+ this.bornSprite = cc.Sprite.createWithSpriteFrameName("ship03.png");
+ this.bornSprite.setBlendFunc(gl.SRC_ALPHA, gl.ONE);
+ this.bornSprite.setPosition(this.getContentSize().width / 2, 12);
+ this.bornSprite.setVisible(false);
+ this.addChild(this.bornSprite, 3000, 99999);
+ },
+ born:function () {
+ //revive effect
+ this.canBeAttack = false;
+ this.bornSprite.setScale(8);
+ this.bornSprite.runAction(cc.ScaleTo.create(0.5, 1, 1));
+ this.bornSprite.setVisible(true);
+ var blinks = cc.Blink.create(3, 9);
+ var makeBeAttack = cc.CallFunc.create(function (t) {
+ t.canBeAttack = true;
+ t.setVisible(true);
+ t.bornSprite.setVisible(false);
+ }.bind(this));
+ this.runAction(cc.Sequence.create(cc.DelayTime.create(0.5), blinks, makeBeAttack));
+
+ this.HP = 5;
+ this._hurtColorLife = 0;
+ this.active = true;
+ }
+});
diff --git a/games/MoonWarriors-Runtime/src/SparkEffect.js b/games/MoonWarriors-Runtime/src/SparkEffect.js
new file mode 100755
index 00000000..10f04aaa
--- /dev/null
+++ b/games/MoonWarriors-Runtime/src/SparkEffect.js
@@ -0,0 +1,72 @@
+var SparkEffect = cc.Class.extend({
+ active:true,
+ spark1:null,
+ spark2:null,
+ scale:1.2,
+ duration:0.7,
+ ctor:function () {
+ this.spark1 = cc.Sprite.createWithSpriteFrameName("explode2.png");
+ this.spark1.setBlendFunc(gl.SRC_ALPHA, gl.ONE);
+ this.spark2 = cc.Sprite.createWithSpriteFrameName("explode3.png");
+ this.spark2.setBlendFunc(gl.SRC_ALPHA, gl.ONE);
+ },
+ reset:function (pos) {
+ this.spark1.setPosition(pos);
+ this.spark2.setPosition(pos);
+
+ this.spark1.setScale(this.scale);
+ this.spark2.setScale(this.scale);
+ this.spark2.setRotation(Math.random() * 360);
+
+ var right = cc.RotateBy.create(this.duration, 45);
+ var scaleBy = cc.ScaleBy.create(this.duration, 3, 3);
+ var seq = cc.Sequence.create(cc.FadeOut.create(this.duration), cc.CallFunc.create(this.destroy, this));
+
+ this.spark1.runAction(right);
+ this.spark1.runAction(scaleBy);
+ this.spark1.runAction(seq);
+
+ this.spark2.runAction(scaleBy.clone());
+ this.spark2.runAction(seq.clone());
+ },
+ destroy:function () {
+ this.active = false;
+ this.spark1.setVisible(false);
+ this.spark2.setVisible(false);
+ }
+});
+
+SparkEffect.getOrCreateSparkEffect = function (pos) {
+ var selChild = null;
+ for (var j = 0; j < MW.CONTAINER.SPARKS.length; j++) {
+ selChild = MW.CONTAINER.SPARKS[j];
+ if (selChild.active == false) {
+ selChild.active = true;
+ selChild.spark1.setVisible(true);
+ selChild.spark2.setVisible(true);
+ selChild.reset(pos);
+ return selChild;
+ }
+ }
+ var spark = SparkEffect.create();
+ spark.reset(pos);
+ return spark;
+};
+
+SparkEffect.create = function () {
+ var sparkEffect = new SparkEffect();
+ g_sharedGameLayer.addSpark(sparkEffect.spark1);
+ g_sharedGameLayer.addSpark(sparkEffect.spark2);
+ MW.CONTAINER.SPARKS.push(sparkEffect);
+ return sparkEffect;
+};
+
+SparkEffect.preSet = function () {
+ var sparkEffect = null;
+ for (var i = 0; i < 6; i++) {
+ sparkEffect = SparkEffect.create();
+ sparkEffect.active = false;
+ sparkEffect.spark1.setVisible(false);
+ sparkEffect.spark2.setVisible(false);
+ }
+};
diff --git a/games/MoonWarriors-Runtime/src/SysMenu.js b/games/MoonWarriors-Runtime/src/SysMenu.js
new file mode 100644
index 00000000..80bf735b
--- /dev/null
+++ b/games/MoonWarriors-Runtime/src/SysMenu.js
@@ -0,0 +1,243 @@
+cc.dumpConfig();
+
+var SysMenu = cc.Layer.extend({
+ _ship: null,
+
+ init: function () {
+ //this.setKeypadEnabled(true);
+ var bRet = false;
+ if (this._super()) {
+
+ var writablePath = cc.FileUtils.getInstance().getWritablePath();
+ cc.log("writablePath: " + writablePath);
+
+ cc.SpriteFrameCache.getInstance().addSpriteFrames(res.textureTransparentPack_plist);
+
+ winSize = cc.Director.getInstance().getWinSize();
+ var sp = cc.Sprite.create(res.loading_png);
+ sp.setAnchorPoint(0, 0);
+ this.addChild(sp, 0, 1);
+
+ var logo = cc.Sprite.create(res.logo_png);
+ logo.setAnchorPoint(0, 0);
+ logo.setPosition(0, 250);
+ this.addChild(logo, 10, 1);
+
+ var newGameNormal = cc.Sprite.create(res.menu_png, cc.rect(0, 0, 126, 33));
+ var newGameSelected = cc.Sprite.create(res.menu_png, cc.rect(0, 33, 126, 33));
+ var newGameDisabled = cc.Sprite.create(res.menu_png, cc.rect(0, 33 * 2, 126, 33));
+
+ var gameSettingsNormal = cc.Sprite.create(res.menu_png, cc.rect(126, 0, 126, 33));
+ var gameSettingsSelected = cc.Sprite.create(res.menu_png, cc.rect(126, 33, 126, 33));
+ var gameSettingsDisabled = cc.Sprite.create(res.menu_png, cc.rect(126, 33 * 2, 126, 33));
+
+ var aboutNormal = cc.Sprite.create(res.menu_png, cc.rect(252, 0, 126, 33));
+ var aboutSelected = cc.Sprite.create(res.menu_png, cc.rect(252, 33, 126, 33));
+ var aboutDisabled = cc.Sprite.create(res.menu_png, cc.rect(252, 33 * 2, 126, 33));
+ var flare = cc.Sprite.create(res.flare_jpg);
+ this.addChild(flare);
+ flare.setVisible(false);
+ var newGame = cc.MenuItemSprite.create(newGameNormal, newGameSelected, newGameDisabled, function () {
+ this.onButtonEffect();
+ //this.onNewGame();
+ flareEffect(flare, this, this.onNewGame);
+ }.bind(this));
+ var gameSettings = cc.MenuItemSprite.create(gameSettingsNormal, gameSettingsSelected, gameSettingsDisabled, this.onSettings, this);
+ var about = cc.MenuItemSprite.create(aboutNormal, aboutSelected, aboutDisabled, this.onAbout, this);
+
+ var menu = cc.Menu.create(newGame, gameSettings, about);
+ menu.alignItemsVerticallyWithPadding(10);
+ this.addChild(menu, 1, 2);
+ menu.setPosition(winSize.width / 2, winSize.height / 2 - 80);
+ this.schedule(this.update, 0.1);
+
+ this._ship = cc.Sprite.createWithSpriteFrameName("ship01.png");
+ this.addChild(this._ship, 0, 4);
+ var pos = cc.p(Math.random() * winSize.width, 0);
+ this._ship.setPosition(pos);
+ this._ship.runAction(cc.MoveBy.create(2, cc.p(Math.random() * winSize.width, pos.y + winSize.height + 100)));
+
+ // game version
+ var versionLabel = cc.LabelTTF.create("version:1.0.2", "Marker Felt", 20);
+ this.addChild(versionLabel, 1, 2);
+ versionLabel.setPosition(winSize.width - 80, winSize.height - 20);
+
+ if (MW.SOUND) {
+ cc.AudioEngine.getInstance().setMusicVolume(0.7);
+ cc.AudioEngine.getInstance().playMusic(res.mainMainMusic_mp3, true);
+ }
+
+ bRet = true;
+ }
+ cc.runtime.setOption("network_error_dialog", {
+ background: {
+ res: "res/dialog_bg.png"
+ },
+ confirmBtn:{
+ normalRes:"res/dialog_confirm_normal.png",
+ pressRes:"res/dialog_confirm_press.png",
+ text:"",
+ position:cc.p(225,25)
+ },
+ cancelBtn:{
+ normalRes:"res/dialog_cancel_normal.png",
+ pressRes:"res/dialog_cancel_press.png",
+ text:"",
+ position:cc.p(75,25)
+ },
+ messageLabel:{
+ text:"网络连接错误哈~~~",
+ position:cc.p(160,30),
+ dimisions:cc.size(200,15),
+ fontSize:20
+ }
+ });
+ cc.runtime.setOption("no_space_error_dialog", {
+ background: {
+ res: "res/dialog_bg.png"
+ },
+ confirmBtn:{
+ normalRes:"res/dialog_confirm_normal.png",
+ pressRes:"res/dialog_confirm_press.png",
+ text:"",
+ position:cc.p(225,25)
+ },
+ cancelBtn:{
+ normalRes:"res/dialog_cancel_normal.png",
+ pressRes:"res/dialog_cancel_press.png",
+ text:"",
+ position:cc.p(75,25)
+ },
+ messageLabel:{
+ text:"没有空间了额~~~",
+ position:cc.p(175,30),
+ dimisions:cc.size(200,15),
+ fontSize:20
+ }
+ });
+ cc.runtime.setOption("verify_error_dialog", {
+ messageLabel:{
+ text:"验证失败了额~~~",
+ position:cc.p(175,30),
+ dimisions:cc.size(200,15),
+ fontSize:20
+ }
+ });
+ cc.LoaderLayer.setConfig({
+ background: {
+ res: "res/loading.png"
+ },
+ logo: {
+ res: "res/logo.png",
+ action: null
+ },
+ title: {
+ show:false
+ },
+ onEnter: function (layer) {
+ cc.log("moonwarriors onEnter");
+ var label = cc.LabelTTF.create("this is moonwarriors","Arial",22);
+ label.setColor(cc.c3b(255,0,0));
+ label.setPosition(cc.p(cc.Director.getInstance().getWinSize().width/2,200));
+ layer.addChild(label);
+ },
+ onExit: function (layer) {
+ cc.log("moonwarriors onExit");
+ },
+ tips: {
+ color: cc.c3b(255, 0, 0),
+ tipsProgress: function (status, loaderlayer) {
+ var statusStr = "runtime正在";
+ if (status.stage == cc.network.preloadstatus.DOWNLOAD) {
+ statusStr += "下载";
+ } else if (status.stage == cc.network.preloadstatus.UNZIP) {
+ statusStr += "解压";
+ }
+ if (status.groupName) {
+ statusStr += status.groupName;
+ }
+ statusStr += " 进度:" + status.percent.toFixed(2) + "%";
+ loaderlayer.getTipsLabel().setString(statusStr);
+ }
+ }
+ });
+ return bRet;
+ },
+ onNewGame: function (pSender) {
+ //load resources
+ Moon.preload(["gamelayer"], function (isSucces) {
+ var scene = cc.Scene.create();
+ scene.addChild(GameLayer.create());
+ scene.addChild(GameControlMenu.create());
+ cc.Director.getInstance().replaceScene(cc.TransitionFade.create(1.2, scene));
+ }, this);
+ },
+ onSettings: function (pSender) {
+ Moon.preload(["common"], function (isSucces) {
+ this.onButtonEffect();
+ var scene = cc.Scene.create();
+ scene.addChild(SettingsLayer.create());
+ cc.Director.getInstance().replaceScene(cc.TransitionFade.create(1.2, scene));
+ }, this);
+ },
+ onAbout:function (pSender) {
+ Moon.preload(["common"], function (isSucces) {
+ this.onButtonEffect();
+ var scene = cc.Scene.create();
+ scene.addChild(AboutLayer.create());
+ cc.Director.getInstance().replaceScene(cc.TransitionFade.create(1.2, scene));
+ }, this);
+ },
+ update: function () {
+ if (this._ship.getPosition().y > 480) {
+ var pos = cc.p(Math.random() * winSize.width, 10);
+ this._ship.setPosition(pos);
+ this._ship.runAction(cc.MoveBy.create(
+ parseInt(5 * Math.random(), 10),
+ cc.p(Math.random() * winSize.width, pos.y + 480)));
+ }
+ },
+ onButtonEffect: function () {
+ if (MW.SOUND) {
+ var s = cc.AudioEngine.getInstance().playEffect(res.buttonEffet_mp3);
+ }
+ }
+});
+
+SysMenu.create = function () {
+ var sg = new SysMenu();
+ if (sg && sg.init()) {
+ return sg;
+ }
+ return null;
+};
+
+SysMenu.scene = function () {
+ var scene = cc.Scene.create();
+ var layer = SysMenu.create();
+ scene.addChild(layer);
+ cc.registerKeyDownEvent(function (keyCode) {
+ if (keyCode == cc.KEY.back) {
+ var node = cc.Node.create();
+ cc.Director.getInstance().getRunningScene().addChild(node);
+ quitLayer("确定退出游戏?", function () {
+ node.scheduleOnce(function() {
+ cc.log("Oops ....");
+ }, 0);
+ cc.Director.getInstance().end();
+ }, function () {
+ cc.log("cancel quit game");
+ });
+ }
+ });
+ return scene;
+};
+
+var Moon = Moon || {};
+Moon.preload = function (resources, selector, target) {
+ cc.LoaderLayer.preload(resources, selector, target);
+};
+
+var quitLayer = function (tips, confirmcallback, cancelcallback) {
+ cc.Dialog.show(tips,confirmcallback,cancelcallback);
+}
diff --git a/games/MoonWarriors-Runtime/src/config/EnemyType.js b/games/MoonWarriors-Runtime/src/config/EnemyType.js
new file mode 100755
index 00000000..c947d589
--- /dev/null
+++ b/games/MoonWarriors-Runtime/src/config/EnemyType.js
@@ -0,0 +1,56 @@
+var EnemyType = [
+ {
+ type:0,
+ textureName:"E0.png",
+ bulletType:"W2.png",
+ HP:1,
+ moveType:MW.ENEMY_MOVE_TYPE.ATTACK,
+ attackMode:MW.ENEMY_MOVE_TYPE.NORMAL,
+ scoreValue:15
+ },
+ {
+ type:1,
+ textureName:"E1.png",
+ bulletType:"W2.png",
+ HP:2,
+ moveType:MW.ENEMY_MOVE_TYPE.ATTACK,
+ attackMode:MW.ENEMY_MOVE_TYPE.NORMAL,
+ scoreValue:40
+ },
+ {
+ type:2,
+ textureName:"E2.png",
+ bulletType:"W2.png",
+ HP:4,
+ moveType:MW.ENEMY_MOVE_TYPE.HORIZONTAL,
+ attackMode:MW.ENEMY_ATTACK_MODE.TSUIHIKIDAN,
+ scoreValue:60
+ },
+ {
+ type:3,
+ textureName:"E3.png",
+ bulletType:"W2.png",
+ HP:6,
+ moveType:MW.ENEMY_MOVE_TYPE.OVERLAP,
+ attackMode:MW.ENEMY_MOVE_TYPE.NORMAL,
+ scoreValue:80
+ },
+ {
+ type:4,
+ textureName:"E4.png",
+ bulletType:"W2.png",
+ HP:10,
+ moveType:MW.ENEMY_MOVE_TYPE.HORIZONTAL,
+ attackMode:MW.ENEMY_ATTACK_MODE.TSUIHIKIDAN,
+ scoreValue:150
+ },
+ {
+ type:5,
+ textureName:"E5.png",
+ bulletType:"W2.png",
+ HP:15,
+ moveType:MW.ENEMY_MOVE_TYPE.HORIZONTAL,
+ attackMode:MW.ENEMY_MOVE_TYPE.NORMAL,
+ scoreValue:200
+ }
+];
diff --git a/games/MoonWarriors-Runtime/src/config/GameConfig.js b/games/MoonWarriors-Runtime/src/config/GameConfig.js
new file mode 100755
index 00000000..677def95
--- /dev/null
+++ b/games/MoonWarriors-Runtime/src/config/GameConfig.js
@@ -0,0 +1,109 @@
+/**
+ * Cocos2d-html5 show case : Moon Warriors
+ *
+ * @Licensed:
+ * This showcase is licensed under GPL.
+ *
+ * @Authors:
+ * Programmer: Shengxiang Chen (陈升想), Dingping Lv (吕定平), Ricardo Quesada
+ * Effects animation: Hao Wu (吴昊)
+ * Quality Assurance: Sean Lin (林顺)
+ *
+ * @Links:
+ * http://www.cocos2d-x.org
+ * http://bbs.html5china.com
+ *
+ */
+
+var MW = MW || {};
+
+//game state
+MW.GAME_STATE = {
+ HOME:0,
+ PLAY:1,
+ OVER:2
+};
+
+//keys
+MW.KEYS = [];
+
+//level
+MW.LEVEL = {
+ STAGE1:1,
+ STAGE2:2,
+ STAGE3:3
+};
+
+//life
+MW.LIFE = 4;
+
+//score
+MW.SCORE = 0;
+
+//sound
+MW.SOUND = true;
+
+//enemy move type
+MW.ENEMY_MOVE_TYPE = {
+ ATTACK:0,
+ VERTICAL:1,
+ HORIZONTAL:2,
+ OVERLAP:3
+};
+
+//delta x
+MW.DELTA_X = -100;
+
+//offset x
+MW.OFFSET_X = -24;
+
+//rot
+MW.ROT = -5.625;
+
+//bullet type
+MW.BULLET_TYPE = {
+ PLAYER:1,
+ ENEMY:2
+};
+
+//weapon type
+MW.WEAPON_TYPE = {
+ ONE:1
+};
+
+//unit tag
+MW.UNIT_TAG = {
+ ENMEY_BULLET:900,
+ PLAYER_BULLET:901,
+ ENEMY:1000,
+ PLAYER:1000
+};
+
+//attack mode
+MW.ENEMY_ATTACK_MODE = {
+ NORMAL:1,
+ TSUIHIKIDAN:2
+};
+
+//life up sorce
+MW.LIFEUP_SORCE = [50000, 100000, 150000, 200000, 250000, 300000];
+
+//container
+MW.CONTAINER = {
+ ENEMIES:[],
+ ENEMY_BULLETS:[],
+ PLAYER_BULLETS:[],
+ EXPLOSIONS:[],
+ SPARKS:[],
+ HITS:[],
+ BACKSKYS:[],
+ BACKTILEMAPS:[]
+};
+
+//bullet speed
+MW.BULLET_SPEED = {
+ ENEMY:-200,
+ SHIP:900
+};
+// the counter of active enemies
+MW.ACTIVE_ENEMIES = 0;
\ No newline at end of file
diff --git a/games/MoonWarriors-Runtime/src/config/Level.js b/games/MoonWarriors-Runtime/src/config/Level.js
new file mode 100755
index 00000000..1699398c
--- /dev/null
+++ b/games/MoonWarriors-Runtime/src/config/Level.js
@@ -0,0 +1,50 @@
+var Level1 = {
+ enemyMax:6,
+ enemies:[
+ {
+ ShowType:"Repeate",
+ ShowTime:"00:02",
+ Types:[0,1,2]
+ },
+ {
+ ShowType:"Repeate",
+ ShowTime:"00:05",
+ Types:[3,4,5]
+ }
+ /*{
+ ShowType:"Repeate",
+ ShowTime:"00:08",
+ Types:[0,4,3,5]
+ },
+ {
+ ShowType:"Once",
+ ShowTime:"00:6",
+ Types:[0,2,4,3]
+ },
+ {
+ ShowType:"Once",
+ ShowTime:"00:16",
+ Types:[0,2,5,4,3]
+ },
+ {
+ ShowType:"Once",
+ ShowTime:"00:25",
+ Types:[0,3,5,4,3]
+ },
+ {
+ ShowType:"Once",
+ ShowTime:"00:35",
+ Types:[4,5,3,1,3]
+ },
+ {
+ ShowType:"Once",
+ ShowTime:"00:50",
+ Types:[0,3,2,1,0,3]
+ },
+ {
+ ShowType:"Once",
+ ShowTime:"01:15",
+ Types:[4,5,2,1,0]
+ }*/
+ ]
+};