Browse Source

Merge pull request #27 from AtomicGameEngine/LME-ATOMIC-UPDATEPLATFORMER

Updates to Physics Platformer & Space Game
JoshEngebretson 10 years ago
parent
commit
5d80063719

+ 1 - 1
PhysicsPlatformer/Resources/Components/Bat.js

@@ -22,7 +22,7 @@ var component = function (self) {
     if(!dayTime) {
     if(!dayTime) {
       //ok, it's a night, then create a light
       //ok, it's a night, then create a light
       var light = node.createComponent("PointLight2D");
       var light = node.createComponent("PointLight2D");
-      light.color = [1, 0.1, 0.8, 1];
+      light.color = [1, 0.1, 0.8, .85];
       light.radius = 1;
       light.radius = 1;
     }
     }
   }
   }

+ 1 - 1
PhysicsPlatformer/Resources/Components/Coin.js

@@ -36,7 +36,7 @@ var component = function(self) {
     if(!dayTime) {
     if(!dayTime) {
       //ok, it's a night, then create a light
       //ok, it's a night, then create a light
       var light = node.createComponent("PointLight2D");
       var light = node.createComponent("PointLight2D");
-      light.color = [1, 1, .56, .8];
+      light.color = [1, 1, .56, .6];
       light.radius = .85;
       light.radius = .85;
 
 
       node.createJSComponent("Components/LightFlicker.js");
       node.createJSComponent("Components/LightFlicker.js");

+ 3 - 2
PhysicsPlatformer/Resources/Components/DayTime.js

@@ -7,9 +7,10 @@ var component = function(self) {
 
 
   self.start = function() {
   self.start = function() {
     if(!dayTime) {
     if(!dayTime) {
-      //if it's night, make TheSun color darker
+      //if it's night, make TheSun color darker - ambient isn't being set properly, see GitHub issue: https://github.com/AtomicGameEngine/AtomicGameEngine/issues/340
+      self.scene.getComponent("Zone").ambientColor = [0, 0, 0, 0.2];
       var sun = self.node.getChild("TheSun").getComponent("DirectionalLight2D");
       var sun = self.node.getChild("TheSun").getComponent("DirectionalLight2D");
-      sun.color = [0.05, 0.05, 0.07, 0.1];
+      sun.enabled = false;
     }
     }
   }
   }
 }
 }

+ 9 - 0
PhysicsPlatformer/Resources/Components/Level.js

@@ -10,6 +10,10 @@ var component = function (self) {
     //get TileMap2D component from our current node
     //get TileMap2D component from our current node
     var tileMap = self.node.getComponent("TileMap2D");
     var tileMap = self.node.getComponent("TileMap2D");
     var tmxFile = tileMap.tmxFile;
     var tmxFile = tileMap.tmxFile;
+    
+    //looping main game song
+    var music = Atomic.cache.getResource("Sound", "Sounds/JumpingBat.ogg");
+    music.looped = true;
 
 
     //create LevelParser object
     //create LevelParser object
     var levelParser = new LevelParser(tileMap);
     var levelParser = new LevelParser(tileMap);
@@ -64,6 +68,11 @@ var component = function (self) {
         var vnode  = self.scene.createChild("Vine");
         var vnode  = self.scene.createChild("Vine");
         vnode.createJSComponent("Components/Vine.js", {startPosition : vines[i].position});
         vnode.createJSComponent("Components/Vine.js", {startPosition : vines[i].position});
     }
     }
+    
+    //reduce num rays on mobile/web platforms for better performance
+    if(Atomic.platform == "Android" || Atomic.platform == "iOS" || Atomic.platform == "WebGL") {
+      self.scene.getChild("TheSun").getComponent("DirectionalLight2D").numRays = 512;
+    }
 
 
   }
   }
 
 

+ 2 - 1
PhysicsPlatformer/Resources/Components/Player.js

@@ -70,10 +70,11 @@ exports.component = function(self) {
         if(!dayTime) {
         if(!dayTime) {
           //ok, it's a night, then create a light
           //ok, it's a night, then create a light
           var light = node.createComponent("PointLight2D");
           var light = node.createComponent("PointLight2D");
-          light.color = [1, 0.5, 0.7, 0.8];
+          light.color = [1, 0.5, 0.7, 0.35];
           light.backtrace = true;
           light.backtrace = true;
           light.castShadows = true;
           light.castShadows = true;
           light.numRays = 256;
           light.numRays = 256;
+          light.radius = 4;
         }
         }
 
 
     }
     }

+ 6 - 6
PhysicsPlatformer/Resources/Scenes/Scene.scene

@@ -5,10 +5,10 @@
 	<attribute name="Smoothing Constant" value="50" />
 	<attribute name="Smoothing Constant" value="50" />
 	<attribute name="Snap Threshold" value="5" />
 	<attribute name="Snap Threshold" value="5" />
 	<attribute name="Elapsed Time" value="0" />
 	<attribute name="Elapsed Time" value="0" />
-	<attribute name="Next Replicated Node ID" value="32079" />
-	<attribute name="Next Replicated Component ID" value="40437" />
-	<attribute name="Next Local Node ID" value="16778812" />
-	<attribute name="Next Local Component ID" value="16777462" />
+	<attribute name="Next Replicated Node ID" value="32799" />
+	<attribute name="Next Replicated Component ID" value="41309" />
+	<attribute name="Next Local Node ID" value="16778818" />
+	<attribute name="Next Local Component ID" value="16777467" />
 	<attribute name="Variables" />
 	<attribute name="Variables" />
 	<attribute name="Variable Names" value="" />
 	<attribute name="Variable Names" value="" />
 	<component type="Octree" id="2" />
 	<component type="Octree" id="2" />
@@ -79,9 +79,9 @@
 		<attribute name="Scale" value="1 1 1" />
 		<attribute name="Scale" value="1 1 1" />
 		<attribute name="Variables" />
 		<attribute name="Variables" />
 		<component type="DirectionalLight2D" id="18606">
 		<component type="DirectionalLight2D" id="18606">
-			<attribute name="Color" value="1 1 1 0.4" />
+			<attribute name="Color" value="1 1 1 0.2" />
 			<attribute name="Cast Shadows" value="true" />
 			<attribute name="Cast Shadows" value="true" />
-			<attribute name="Num Rays" value="512" />
+			<attribute name="Num Rays" value="1024" />
 		</component>
 		</component>
 	</node>
 	</node>
 	<node id="19834">
 	<node id="19834">

+ 7 - 1
SpaceGame/Resources/UI/mainMenu.js

@@ -27,6 +27,12 @@ exports.init = function() {
   view.addChild(window);
   view.addChild(window);
   window.center();
   window.center();
 
 
+  //Explicitly quitting an app is not allowed on iOS
+  if(Atomic.platform == "iOS") {
+   window.getWidget("quit").visibility = Atomic.UI_WIDGET_VISIBILITY_GONE;
+  }
+    
+
   window.getWidget("new_game").onClick = function () {
   window.getWidget("new_game").onClick = function () {
 
 
     closeWindow();
     closeWindow();
@@ -58,7 +64,7 @@ exports.init = function() {
 
 
 
 
   window.getWidget("quit").onClick = function () {
   window.getWidget("quit").onClick = function () {
-
+    
     game.engine.exit();
     game.engine.exit();
 
 
   }
   }