forked from iTyran/Tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
81 changed files
with
1,958 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/**************************************************************************** | ||
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. | ||
****************************************************************************/ | ||
(function () { | ||
var d = document; | ||
var c = { | ||
COCOS2D_DEBUG:2, //0 to turn debug off, 1 for basic debug, and 2 for full debug | ||
box2d:true, | ||
chipmunk:true, | ||
showFPS:true, | ||
frameRate:60, | ||
loadExtension:true, | ||
renderMode:0, //Choose of RenderMode: 0(default), 1(Canvas only), 2(WebGL only) | ||
tag:'gameCanvas', //the dom element to run cocos2d on | ||
engineDir:'../cocos2d/', | ||
//SingleEngineFile:'', | ||
appFiles:[ | ||
'src/resource.js', | ||
'src/GameConfig.js', // 配置 | ||
'src/HudLayer.js', // 控制 | ||
'src/Characters.js', // 人物 | ||
'src/KeyMap.js', // 键盘映射 | ||
'src/Joypad.js', // 摇杆控制器 | ||
'src/ActionButton.js', // 按钮 | ||
'src/GameLayer.js', // 游戏层 | ||
'src/Loading.js' // 自定义加载界面 | ||
] | ||
}; | ||
|
||
if(!d.createElement('canvas').getContext){ | ||
var s = d.createElement('div'); | ||
s.innerHTML = '<h2>Your browser does not support HTML5 canvas!</h2>' + | ||
'<p>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.</p>' + | ||
'<a href="http://www.google.com/chrome" target="_blank"><img src="http://www.google.com/intl/zh-CN/chrome/assets/common/images/chrome_logo_2x.png" border="0"/></a>'; | ||
var p = d.getElementById(c.tag).parentNode; | ||
p.style.background = 'none'; | ||
p.style.border = 'none'; | ||
p.insertBefore(s); | ||
|
||
d.body.style.background = '#ffffff'; | ||
return; | ||
} | ||
|
||
window.addEventListener('DOMContentLoaded', function () { | ||
//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 + 'platform/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 | ||
|
||
document.ccConfig = c; | ||
s.id = 'cocos2d-html5'; | ||
d.body.appendChild(s); | ||
//else if single file specified, load singlefile | ||
}); | ||
})(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Cocos2d-html5 Hello World test</title> | ||
<link rel="icon" type="image/GIF" href="res/favicon.ico"/> | ||
<meta name="viewport" content="width=800,user-scalable=no"/> | ||
<meta name="screen-orientation" content="portrait"/> | ||
<meta name="apple-mobile-web-app-capable" content="yes"/> | ||
<meta name="full-screen" content="yes"/> | ||
<meta name="x5-fullscreen" content="true"/> | ||
<style> | ||
body, canvas, div { | ||
-moz-user-select: none; | ||
-webkit-user-select: none; | ||
-ms-user-select: none; | ||
-khtml-user-select: none; | ||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0); | ||
} | ||
</style> | ||
</head> | ||
<body style="padding:0; margin: 0; background: #000;"> | ||
<div style="text-align: center;"> | ||
<canvas id="gameCanvas" width="800" height="600"></canvas> | ||
</div> | ||
</body> | ||
</html> | ||
<script src="cocos2d.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/**************************************************************************** | ||
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.initDebugSetting(); | ||
cc.setup(this.config['tag']); | ||
cc.AppController.shareAppController().didFinishLaunchingWithOptions(); | ||
}, | ||
applicationDidFinishLaunching:function () { | ||
if(cc.RenderDoesnotSupport()){ | ||
//show Information to user | ||
alert("Browser doesn't support WebGL"); | ||
return false; | ||
} | ||
// initialize director | ||
var director = cc.Director.getInstance(); | ||
|
||
// enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices. | ||
//director.enableRetinaDisplay(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 | ||
Loading.preload(g_resources, function () { | ||
// cc.LoaderScene.preload(g_resources, function () { | ||
director.replaceScene(new this.startScene()); | ||
}, this); | ||
// Loading.preload(g_resources, function () { | ||
// director.replaceScene(new this.startScene()); | ||
// }, this); | ||
|
||
return true; | ||
} | ||
}); | ||
var myApp = new cocos2dApp(GameLayer.scene); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
* 王者之剑 Demo | ||
|
||
* todo list | ||
|
||
** DONE 英雄血条状态 | ||
CLOSED: [2013-08-19 Mon 15:52] | ||
|
||
** DONE 怪物血条状态 | ||
CLOSED: [2013-08-22 Thu 09:26] | ||
|
||
** DONE 血条状态封装实现 | ||
CLOSED: [2013-08-22 Thu 09:26] | ||
实现英雄和怪物的通用封装 | ||
|
||
** DONE 人物走动位置边界判断 | ||
CLOSED: [2013-08-20 Tue 11:04] | ||
|
||
** TODO 怪物自动攻击 AI | ||
|
||
** DONE 人物动作封装 | ||
CLOSED: [2013-08-22 Thu 09:26] | ||
|
||
** TODO 怪物动作封装实现 | ||
|
||
** DONE 特效攻击冷冻 | ||
CLOSED: [2013-08-22 Thu 09:26] | ||
|
||
** DONE 攻击按钮实现效果 | ||
CLOSED: [2013-08-22 Thu 09:26] | ||
完成 API 调用 | ||
|
||
** 攻击按钮键盘映射 | ||
CLOSED: [2013-08-20 Tue 14:58] | ||
|
||
** DONE 状态 标题 | ||
CLOSED: [2013-08-22 Thu 14:11] | ||
如 "吾名一叶" "锤子兵" 的 Title | ||
|
||
** DONE 层级检测 | ||
CLOSED: [2013-08-22 Thu 13:39] | ||
多层游戏元素,更具位置判断前后关系 | ||
|
||
** DONE 掉血动作 | ||
CLOSED: [2013-08-22 Thu 16:59] | ||
一个数字往上升 | ||
|
||
** TODO 跳跃的位置检测 | ||
需要排除跳跃攻击的 边界检测,否则落地错误 | ||
|
||
** DONE 打击范围判断 | ||
CLOSED: [2013-08-23 Fri 09:47] | ||
当然还有打击方向 | ||
打击前设定当前“打击对象”的攻击区域,和被打击对象的区域 | ||
还需要判断是否在同一个高度,打击对象与被打击对象所在的 y 轴差,在一定值之内 | ||
|
||
** DONE 掉血延迟 | ||
CLOSED: [2013-08-23 Fri 09:47] | ||
|
||
** DONE 血条跟随掉血 | ||
CLOSED: [2013-08-23 Fri 11:26] | ||
|
||
** TODO 不同动作之间过度不流畅 | ||
|
||
** TODO 简单 AI | ||
实现怪物自动攻击 | ||
|
||
* Html5 问题 | ||
BMF 不能使用 FadeOut | ||
|
||
* 美术资源总结 | ||
同样人物,或者元素,动画使用相同大小图片 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file not shown.
Oops, something went wrong.