Ver Fonte

Physics Platformer Updates

Josh Engebretson há 10 anos atrás
pai
commit
71d9d68121

+ 1 - 0
PhysicsPlatformerNew/Resources/Components/Level.js

@@ -48,6 +48,7 @@ var component = function (self) {
     for (var i = 0; i < bats.length; i++) {
         var node = self.scene.createChildPrefab("Bat", "Prefabs/Bat.prefab");
         node.position2D = bats[i].position;
+        node.scale2D = [.5, .5];
         node.waypoints = waypoints;
     }
 

+ 12 - 2
PhysicsPlatformerNew/Resources/Components/Player.js

@@ -1,12 +1,20 @@
 
 "atomic component";
 
+var inspectorFields = {
+
+  jumpSound: ["Sound"]
+
+}
+
+
 module.exports = function(self) {
 
   var node = self.node;
   var camera = self.node.scene.getMainCamera();
   var cameraNode = camera.node;
   var input = Atomic.input;
+  var soundSource = node.getComponent("SoundSource");
 
   var MAX_VELOCITY = 3;
   var anim = "";
@@ -161,8 +169,10 @@ module.exports = function(self) {
       if (jump && jumpDelta <= 0 && contactCount) {
 
           jumpDelta = .25;
-          //self.soundSource.gain = 0.45;
-          //self.soundSource.play(jumpSound);
+          if (self.jumpSound) {          
+              soundSource.gain = 0.45;
+              soundSource.play(self.jumpSound);          
+          }
 
           vel[1] = 0;
           body.linearVelocity = vel;

+ 9 - 3
PhysicsPlatformerNew/Resources/Prefabs/Hero.prefab

@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<node id="2540">
+<node id="20555">
 	<attribute name="Is Enabled" value="true" />
 	<attribute name="Name" value="Hero" />
 	<attribute name="Position" value="0 0 0" />
@@ -7,23 +7,29 @@
 	<attribute name="Scale" value="1 1 1" />
 	<attribute name="Variables" />
 	<component type="AnimatedSprite2D" id="1979">
-		<attribute name="Animation Set" value="AnimationSet2D;Sprites/Hero/Hero.scml" />
 		<attribute name="Layer" value="100" />
+		<attribute name="Animation Set" value="AnimationSet2D;Sprites/Hero/Hero.scml" />
 		<attribute name="Animation" value="Run" />
 	</component>
 	<component type="RigidBody2D" id="1982">
 		<attribute name="Body Type" value="Dynamic" />
+		<attribute name="Mass" value="0.785398" />
 		<attribute name="Fixed Rotation" value="true" />
 		<attribute name="Bullet" value="true" />
 		<attribute name="CastShadows" value="false" />
 	</component>
 	<component type="CollisionCircle2D" id="1984">
 		<attribute name="Radius" value="0.5" />
+		<attribute name="Category Bits" value="1" />
+		<attribute name="Mask Bits" value="65535" />
 		<attribute name="Density" value="1" />
 		<attribute name="Restitution" value="0.1" />
-		<attribute name="Friction" value="0.2" />
 	</component>
 	<component type="JSComponent" id="4617">
+		<attribute name="FieldValues">
+			<variant hash="3172950753" type="ResourceRef" value="Sound;Sounds/Jump13.ogg" />
+		</attribute>
 		<attribute name="ComponentFile" value="JSComponentFile;Components/Player.js" />
 	</component>
+	<component type="SoundSource" id="26471" />
 </node>

+ 16 - 4
PhysicsPlatformerNew/Resources/Scenes/Scene.scene

@@ -5,10 +5,10 @@
 	<attribute name="Smoothing Constant" value="50" />
 	<attribute name="Snap Threshold" value="5" />
 	<attribute name="Elapsed Time" value="0" />
-	<attribute name="Next Replicated Node ID" value="18394" />
-	<attribute name="Next Replicated Component ID" value="23853" />
-	<attribute name="Next Local Node ID" value="16778684" />
-	<attribute name="Next Local Component ID" value="16777360" />
+	<attribute name="Next Replicated Node ID" value="21276" />
+	<attribute name="Next Replicated Component ID" value="27344" />
+	<attribute name="Next Local Node ID" value="16778716" />
+	<attribute name="Next Local Component ID" value="16777384" />
 	<attribute name="Variables" />
 	<attribute name="Variable Names" value="" />
 	<component type="Octree" id="2" />
@@ -81,4 +81,16 @@
 			<attribute name="Num Rays" value="256" />
 		</component>
 	</node>
+	<node id="19834">
+		<attribute name="Is Enabled" value="true" />
+		<attribute name="Name" value="Muzak" />
+		<attribute name="Position" value="0 0 0" />
+		<attribute name="Rotation" value="1 0 0 0" />
+		<attribute name="Scale" value="1 1 1" />
+		<attribute name="Variables" />
+		<component type="SoundSource" id="25597">
+			<attribute name="Sound" value="Sound;Sounds/JumpingBat.ogg" />
+			<attribute name="Autoplay" value="true" />
+		</component>
+	</node>
 </scene>