Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #217 from Dhilan007/master
Add game demo FruitAttack
- Loading branch information
Showing
41 changed files
with
2,515 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,81 @@ | ||
/**************************************************************************** | ||
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:false, | ||
chipmunk:false, | ||
showFPS:true, | ||
frameRate:60, | ||
loadExtension:true, | ||
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:'', | ||
appFiles:['src/CCNotificationCenter.js','src/WelcomeLayer.js','src/GameData.js', | ||
'src/Pattern.js', 'src/PatternMatrix.js','src/ResultLayer.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>Fruit Attack</title> | ||
<link rel="icon" type="image/GIF" href="res/favicon.ico"/> | ||
<meta name="viewport" content="width=320,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;"> | ||
|
||
<canvas id="gameCanvas" width="800" height="450"></canvas> | ||
|
||
</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,60 @@ | ||
/**************************************************************************** | ||
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 Canvas or WebGL"); | ||
return false; | ||
} | ||
// initialize director | ||
var director = cc.Director.getInstance(); | ||
cc.EGLView.getInstance().setDesignResolutionSize(320,480,cc.RESOLUTION_POLICY.SHOW_ALL); | ||
|
||
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(g_ressources, function(){ | ||
director.replaceScene(new this.startScene()); | ||
}, this); | ||
|
||
return true; | ||
} | ||
}); | ||
var myApp = new cocos2dApp(MyGameScene); |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.