Permalink
Browse files

Added plenty of features

  • Loading branch information...
Viktor Lidholt
Viktor Lidholt committed Dec 12, 2012
1 parent 32e8c9f commit 8ac4d58e7c0085cf7ccf2f03e59587ed47b04c1c
Showing with 3,239 additions and 470 deletions.
  1. BIN Images/Crystals.psd
  2. BIN Images/Splash.psd
  3. 0 Published-HTML5/GameBoard.js
  4. BIN Published-HTML5/GameScene.ccbi
  5. +368 −13 Published-HTML5/GameScene.js
  6. BIN Published-HTML5/MainScene.ccbi
  7. +72 −9 Published-HTML5/MainScene.js
  8. +2 −1 Published-HTML5/boot-html5.js
  9. +18 −16 Published-HTML5/cocos2d-html5.min.js
  10. BIN Published-HTML5/{gems/1.png → crystals/bomb-explo-inner.png}
  11. BIN Published-HTML5/{gems/0.png → crystals/bomb-explo.png}
  12. BIN Published-HTML5/{gems/2.png → crystals/bomb-hi.png}
  13. BIN Published-HTML5/crystals/bomb-light.png
  14. BIN Published-HTML5/crystals/bomb.png
  15. BIN Published-HTML5/gamescene/bg-shimmer-0.png
  16. BIN Published-HTML5/gamescene/bg-shimmer-1-no.png
  17. BIN Published-HTML5/gamescene/bg-shimmer-1-non.png
  18. BIN Published-HTML5/gamescene/bg-shimmer-1.png
  19. BIN Published-HTML5/gamescene/sparkle.png
  20. +108 −0 Published-HTML5/particles/falling-gem.plist
  21. +108 −0 Published-HTML5/particles/power-play.plist
  22. BIN Published-HTML5/particles/taken-gem.png
  23. BIN Published-HTML5/particles/taken-gem.png.png
  24. +108 −0 Published-HTML5/particles/taken-hrow.plist
  25. +108 −0 Published-HTML5/particles/taken-vrow.plist
  26. +23 −7 Published-HTML5/resources-html5.js
  27. 0 Published-iOS/GameBoard.js
  28. BIN Published-iOS/GameScene.ccbi
  29. +368 −13 Published-iOS/GameScene.js
  30. BIN Published-iOS/MainScene.ccbi
  31. +72 −9 Published-iOS/MainScene.js
  32. BIN Published-iOS/crystals/bomb-explo-inner.png
  33. BIN Published-HTML5/gems/4.png → Published-iOS/crystals/bomb-explo.png
  34. BIN Published-HTML5/gems/3.png → Published-iOS/crystals/bomb-hi.png
  35. BIN Published-iOS/crystals/bomb-light.png
  36. BIN Published-iOS/crystals/bomb.png
  37. BIN Published-iOS/crystals/resources-ipad/bomb-explo-inner.png
  38. BIN Published-iOS/crystals/resources-ipad/bomb-explo.png
  39. BIN Published-iOS/crystals/resources-ipad/bomb-hi.png
  40. BIN Published-iOS/crystals/resources-ipad/bomb-light.png
  41. BIN Published-iOS/crystals/resources-ipad/bomb.png
  42. BIN Published-iOS/crystals/resources-iphone/bomb-explo-inner.png
  43. BIN Published-iOS/crystals/resources-iphone/bomb-explo.png
  44. BIN Published-iOS/crystals/resources-iphone/bomb-hi.png
  45. BIN Published-iOS/crystals/resources-iphone/bomb-light.png
  46. BIN Published-iOS/crystals/resources-iphone/bomb.png
  47. BIN Published-iOS/crystals/resources-iphonehd/bomb-explo-inner.png
  48. BIN Published-iOS/crystals/resources-iphonehd/bomb-explo.png
  49. BIN Published-iOS/crystals/resources-iphonehd/bomb-hi.png
  50. BIN Published-iOS/crystals/resources-iphonehd/bomb-light.png
  51. BIN Published-iOS/crystals/resources-iphonehd/bomb.png
  52. BIN Published-iOS/gamescene/bg-shimmer-0.png
  53. BIN Published-iOS/gamescene/bg-shimmer-1-no.png
  54. BIN Published-iOS/gamescene/bg-shimmer-1-non.png
  55. BIN Published-iOS/gamescene/bg-shimmer-1.png
  56. BIN Published-iOS/gamescene/resources-ipad/bg-shimmer-0.png
  57. BIN Published-iOS/gamescene/resources-ipad/bg-shimmer-1-no.png
  58. BIN Published-iOS/gamescene/resources-ipad/bg-shimmer-1-non.png
  59. BIN Published-iOS/gamescene/resources-ipad/bg-shimmer-1.png
  60. BIN Published-iOS/gamescene/resources-ipad/sparkle.png
  61. BIN Published-iOS/gamescene/resources-iphone/bg-shimmer-0.png
  62. BIN Published-iOS/gamescene/resources-iphone/bg-shimmer-1-no.png
  63. BIN Published-iOS/gamescene/resources-iphone/bg-shimmer-1-non.png
  64. BIN Published-iOS/gamescene/resources-iphone/bg-shimmer-1.png
  65. BIN Published-iOS/gamescene/resources-iphone/sparkle.png
  66. BIN Published-iOS/gamescene/resources-iphonehd/bg-shimmer-0.png
  67. BIN Published-iOS/gamescene/resources-iphonehd/bg-shimmer-1-no.png
  68. BIN Published-iOS/gamescene/resources-iphonehd/bg-shimmer-1-non.png
  69. BIN Published-iOS/gamescene/resources-iphonehd/bg-shimmer-1.png
  70. BIN Published-iOS/gamescene/resources-iphonehd/sparkle.png
  71. BIN Published-iOS/gamescene/sparkle.png
  72. +2 −0 Published-iOS/main.js
  73. +108 −0 Published-iOS/particles/falling-gem.plist
  74. +108 −0 Published-iOS/particles/power-play.plist
  75. BIN Published-iOS/particles/taken-gem.png
  76. BIN Published-iOS/particles/taken-gem.png.png
  77. +108 −0 Published-iOS/particles/taken-hrow.plist
  78. +108 −0 Published-iOS/particles/taken-vrow.plist
  79. +0 −15 Published-iOS/scorefont.fnt
  80. BIN Published-iOS/scorefont.png
  81. +0 −333 Resources/GameBoard.js
  82. +89 −0 Resources/GameScene.ccb
  83. +591 −12 Resources/GameScene.js
  84. +266 −3 Resources/MainScene.ccb
  85. +72 −9 Resources/MainScene.js
  86. BIN Resources/crystals/resources-auto/bomb-explo-inner.png
  87. BIN Resources/crystals/resources-auto/bomb-explo.png
  88. BIN Resources/crystals/resources-auto/bomb-hi.png
  89. BIN Resources/crystals/resources-auto/bomb-light.png
  90. BIN Resources/crystals/resources-auto/bomb.png
  91. 0 {Published-iOS → Resources/fonts}/resources-iphonehd/scorefont.fnt
  92. BIN {Published-iOS → Resources/fonts}/resources-iphonehd/scorefont.png
  93. 0 {Published-HTML5 → Resources/fonts}/scorefont.fnt
  94. BIN {Published-HTML5 → Resources/fonts}/scorefont.png
  95. +108 −0 Resources/particles/falling-gem.plist
  96. +108 −0 Resources/particles/power-play.plist
  97. BIN Resources/particles/taken-gem.png
  98. BIN Resources/particles/taken-gem.png.png
  99. +108 −0 Resources/particles/taken-hrow.plist
  100. +108 −0 Resources/particles/taken-vrow.plist
  101. +0 −15 Resources/resources-iphonehd/scorefont.fnt
  102. BIN Resources/resources-iphonehd/scorefont.png
  103. +0 −15 Resources/scorefont.fnt
  104. BIN Resources/scorefont.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
No changes.
Binary file not shown.

Large diffs are not rendered by default.

Oops, something went wrong.
Binary file not shown.
@@ -2,15 +2,15 @@ var kMenuSelectionNone = 0;
var kMenuSelectionPlay = 1;
var kMenuSelectionAbout = 2;
+var gLastScore = 0;
+
//
// MainScene class
//
var MainScene = function(){};
MainScene.prototype.onDidLoadFromCCB = function()
{
- cc.log("MainScene did load");
-
// Setup particles in background
var starParticles = cc.ParticleSystem.create("particles/bg-stars.plist");
this.starNode.addChild(starParticles);
@@ -20,26 +20,89 @@ MainScene.prototype.onDidLoadFromCCB = function()
// Setup callback for completed animations
this.rootNode.animationManager.setCompletedAnimationCallback(this, this.onAnimationComplete);
+ this.lblLastScore.setString(""+gLastScore);
+
+ // Setup falling gems
+ this.fallingGems = new Array();
+
+ // Schedule callback
+ this.rootNode.onUpdate = function(dt) {
+ this.controller.onUpdate();
+ };
+ this.rootNode.schedule(this.rootNode.onUpdate);
+
+ // Load sprite sheets
+ cc.SpriteFrameCache.getInstance().addSpriteFrames("crystals.plist");
};
// Create callback for button
MainScene.prototype.onPressPlay = function()
-{
- cc.log("Clicked button");
-
+{
this.menuSelection = kMenuSelectionPlay;
this.rootNode.animationManager.runAnimationsForSequenceNamed("Outro");
- //var scene = cc.BuilderReader.loadAsScene("GameScene.ccbi");
- //cc.Director.getInstance().replaceScene(scene);
+ // Fade out gems
+ for (var i = 0; i < this.fallingGems.length; i++)
+ {
+ var gem = this.fallingGems[i];
+ gem.sprt.runAction(cc.FadeOut.create(0.5));
+ //gem.particle.stopSystem();
+ }
};
MainScene.prototype.onAnimationComplete = function()
{
- cc.log("Animation complete!");
if (this.menuSelection == kMenuSelectionPlay)
{
var scene = cc.BuilderReader.loadAsScene("GameScene.ccbi");
cc.Director.getInstance().replaceScene(scene);
}
-};
+};
+
+MainScene.prototype.onUpdate = function()
+{
+ if (Math.random() < 0.02)
+ {
+ var type = Math.floor(Math.random()*5);
+ //var sprt = cc.Sprite.createWithSpriteFrameName("crystals/"+type+".png");
+ var sprt = cc.Sprite.create("crystals/"+type+".png");
+ //var p = cc.ParticleSystem.create("particles/falling-gem.plist");
+
+ var x = Math.random()*this.fallingGemsLayer.getContentSize().width;
+ var y = this.fallingGemsLayer.getContentSize().height + kGemSize/2;
+ var scale = 0.2 + 0.8 * Math.random();
+
+ var speed = 2*scale*kGemSize/40;
+
+ sprt.setPosition(cc.p(x,y));
+ sprt.setScale(scale);
+
+ //p.setPosition(cc.p(x,y));
+ //p.setScale(scale);
+ //p.setAutoRemoveOnFinish(true);
+
+ var gem = {sprt:sprt, speed:speed};
+ //var gem = {sprt:sprt, speed:speed, particle:p};
+ this.fallingGems.push(gem);
+
+ //this.fallingGemsLayer.addChild(p);
+ this.fallingGemsLayer.addChild(sprt);
+ }
+
+ for (var i = this.fallingGems.length-1; i >= 0; i--)
+ {
+ var gem = this.fallingGems[i];
+
+ var pos = gem.sprt.getPosition();
+ pos.y -= gem.speed;
+ gem.sprt.setPosition(pos);
+ //gem.particle.setPosition(pos);
+
+ if (pos.y < -kGemSize/2)
+ {
+ this.fallingGemsLayer.removeChild(gem.sprt, true);
+ //gem.particle.stopSystem();
+ this.fallingGems.splice(i, 1);
+ }
+ }
+};
@@ -12,7 +12,8 @@
//engineDir:'../../../../cocos2d/',
SingleEngineFile:'cocos2d-html5.min.js',
appFiles:[
- 'GameScene.js',
+ 'GameBoard.js',
+ 'GameScene.js',
'MainScene.js',
'resources-html5.js',

Large diffs are not rendered by default.

Oops, something went wrong.
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.
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.
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.
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>angle</key>
+ <real>130.67999267578125</real>
+ <key>angleVariance</key>
+ <real>189.86000061035156</real>
+ <key>blendFuncDestination</key>
+ <integer>1</integer>
+ <key>blendFuncSource</key>
+ <integer>770</integer>
+ <key>duration</key>
+ <real>-1</real>
+ <key>emitterType</key>
+ <real>0.0</real>
+ <key>finishColorAlpha</key>
+ <real>0.0</real>
+ <key>finishColorBlue</key>
+ <real>0.41999998688697815</real>
+ <key>finishColorGreen</key>
+ <real>0.85000002384185791</real>
+ <key>finishColorRed</key>
+ <real>0.79000002145767212</real>
+ <key>finishColorVarianceAlpha</key>
+ <real>0.0</real>
+ <key>finishColorVarianceBlue</key>
+ <real>0.25999999046325684</real>
+ <key>finishColorVarianceGreen</key>
+ <real>0.50999999046325684</real>
+ <key>finishColorVarianceRed</key>
+ <real>0.44999998807907104</real>
+ <key>finishParticleSize</key>
+ <real>30</real>
+ <key>finishParticleSizeVariance</key>
+ <real>10</real>
+ <key>gravityx</key>
+ <real>0.0</real>
+ <key>gravityy</key>
+ <real>0.0</real>
+ <key>maxParticles</key>
+ <real>50</real>
+ <key>maxRadius</key>
+ <real>100</real>
+ <key>maxRadiusVariance</key>
+ <real>2</real>
+ <key>minRadius</key>
+ <real>0.0</real>
+ <key>particleLifespan</key>
+ <real>0.5</real>
+ <key>particleLifespanVariance</key>
+ <real>1</real>
+ <key>radialAccelVariance</key>
+ <real>10</real>
+ <key>radialAcceleration</key>
+ <real>0.0</real>
+ <key>rotatePerSecond</key>
+ <real>45</real>
+ <key>rotatePerSecondVariance</key>
+ <real>5</real>
+ <key>rotationEnd</key>
+ <real>0.0</real>
+ <key>rotationEndVariance</key>
+ <real>0.0</real>
+ <key>rotationStart</key>
+ <real>0.0</real>
+ <key>rotationStartVariance</key>
+ <real>0.0</real>
+ <key>sourcePositionVariancex</key>
+ <real>10</real>
+ <key>sourcePositionVariancey</key>
+ <real>10</real>
+ <key>sourcePositionx</key>
+ <real>148.96395874023438</real>
+ <key>sourcePositiony</key>
+ <real>213.20474243164062</real>
+ <key>speed</key>
+ <real>0.0</real>
+ <key>speedVariance</key>
+ <real>5</real>
+ <key>startColorAlpha</key>
+ <real>0.75999999046325684</real>
+ <key>startColorBlue</key>
+ <real>0.57999998331069946</real>
+ <key>startColorGreen</key>
+ <real>0.0</real>
+ <key>startColorRed</key>
+ <real>0.31999999284744263</real>
+ <key>startColorVarianceAlpha</key>
+ <real>0.079999998211860657</real>
+ <key>startColorVarianceBlue</key>
+ <real>0.87999999523162842</real>
+ <key>startColorVarianceGreen</key>
+ <real>0.0</real>
+ <key>startColorVarianceRed</key>
+ <real>0.41999998688697815</real>
+ <key>startParticleSize</key>
+ <real>50</real>
+ <key>startParticleSizeVariance</key>
+ <real>50</real>
+ <key>tangentialAccelVariance</key>
+ <real>0.0</real>
+ <key>tangentialAcceleration</key>
+ <real>0.0</real>
+ <key>textureFileName</key>
+ <string>taken-gem.png</string>
+</dict>
+</plist>
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>angle</key>
+ <real>130.67999267578125</real>
+ <key>angleVariance</key>
+ <real>189.86000061035156</real>
+ <key>blendFuncDestination</key>
+ <integer>1</integer>
+ <key>blendFuncSource</key>
+ <integer>770</integer>
+ <key>duration</key>
+ <real>-1</real>
+ <key>emitterType</key>
+ <real>0.0</real>
+ <key>finishColorAlpha</key>
+ <real>0.56999999284744263</real>
+ <key>finishColorBlue</key>
+ <real>0.41999998688697815</real>
+ <key>finishColorGreen</key>
+ <real>0.85000002384185791</real>
+ <key>finishColorRed</key>
+ <real>0.79000002145767212</real>
+ <key>finishColorVarianceAlpha</key>
+ <real>0.46000000834465027</real>
+ <key>finishColorVarianceBlue</key>
+ <real>0.25999999046325684</real>
+ <key>finishColorVarianceGreen</key>
+ <real>0.50999999046325684</real>
+ <key>finishColorVarianceRed</key>
+ <real>0.44999998807907104</real>
+ <key>finishParticleSize</key>
+ <real>10</real>
+ <key>finishParticleSizeVariance</key>
+ <real>0.0</real>
+ <key>gravityx</key>
+ <real>434.20999145507812</real>
+ <key>gravityy</key>
+ <real>355.260009765625</real>
+ <key>maxParticles</key>
+ <real>250</real>
+ <key>maxRadius</key>
+ <real>100</real>
+ <key>maxRadiusVariance</key>
+ <real>2</real>
+ <key>minRadius</key>
+ <real>0.0</real>
+ <key>particleLifespan</key>
+ <real>3.0099999904632568</real>
+ <key>particleLifespanVariance</key>
+ <real>2</real>
+ <key>radialAccelVariance</key>
+ <real>-565.78997802734375</real>
+ <key>radialAcceleration</key>
+ <real>328.95001220703125</real>
+ <key>rotatePerSecond</key>
+ <real>45</real>
+ <key>rotatePerSecondVariance</key>
+ <real>5</real>
+ <key>rotationEnd</key>
+ <real>0.0</real>
+ <key>rotationEndVariance</key>
+ <real>0.0</real>
+ <key>rotationStart</key>
+ <real>0.0</real>
+ <key>rotationStartVariance</key>
+ <real>0.0</real>
+ <key>sourcePositionVariancex</key>
+ <real>121.5</real>
+ <key>sourcePositionVariancey</key>
+ <real>240</real>
+ <key>sourcePositionx</key>
+ <real>160</real>
+ <key>sourcePositiony</key>
+ <real>211.72000122070312</real>
+ <key>speed</key>
+ <real>480.260009765625</real>
+ <key>speedVariance</key>
+ <real>164.47000122070312</real>
+ <key>startColorAlpha</key>
+ <real>0.75999999046325684</real>
+ <key>startColorBlue</key>
+ <real>0.57999998331069946</real>
+ <key>startColorGreen</key>
+ <real>0.0</real>
+ <key>startColorRed</key>
+ <real>0.31999999284744263</real>
+ <key>startColorVarianceAlpha</key>
+ <real>0.079999998211860657</real>
+ <key>startColorVarianceBlue</key>
+ <real>0.87999999523162842</real>
+ <key>startColorVarianceGreen</key>
+ <real>0.0</real>
+ <key>startColorVarianceRed</key>
+ <real>0.41999998688697815</real>
+ <key>startParticleSize</key>
+ <real>19.790000915527344</real>
+ <key>startParticleSizeVariance</key>
+ <real>29.049999237060547</real>
+ <key>tangentialAccelVariance</key>
+ <real>302.6300048828125</real>
+ <key>tangentialAcceleration</key>
+ <real>565.78997802734375</real>
+ <key>textureFileName</key>
+ <string>taken-gem.png</string>
+</dict>
+</plist>
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.

0 comments on commit 8ac4d58

Please sign in to comment.