Josh Engebretson 11 years ago
parent
commit
558e8b4b09

+ 8 - 3
PhysicsPlatformer/Resources/Components/Avatar.js

@@ -14,7 +14,7 @@ sprite.setAnimation(animationSet, "Idle");
 sprite.setLayer(100);
 
 var light = node.createComponent("PointLight2D");
-light.color = [1, 1, 1, .5];
+light.color = [1, 1, 1, .55];
 light.softShadowLength = 20;
 light.radius = 20;
 light.castShadows = true;
@@ -51,6 +51,7 @@ var anim = "Idle";
 var flipped = false;
 var contactCount = 0;
 var jumpDelta = 0;
+var control = false;
 
 self.onPhysicsBeginContact2D = function(world, bodyA, bodyB, nodeA, nodeB) {
 
@@ -101,14 +102,14 @@ function handleAnimation(timeStep) {
 
     if (contactCount) {
 
-        if (vel[0] < -0.75) {
+        if (vel[0] < -0 && control) {
             if (!flipped) {
                 sprite.flipX = true;
                 flipped = true;
 
             }
             setAnimation("Run");
-        } else if (vel[0] > 0.75) {
+        } else if (vel[0] > 0 && control) {
 
             if (flipped) {
                 sprite.flipX = false;
@@ -168,6 +169,10 @@ function handleInput(timeStep) {
             zoomOut = true;
 
     }
+    
+    control = false;
+    if (left || right)
+        control  = true;
 
     if (zoomIn)
         camera.zoom += timeStep;

+ 4 - 0
PhysicsPlatformer/Resources/Levels/Level1.tmx

@@ -18,6 +18,10 @@
   <object gid="23" x="848.785" y="1283.28"/>
   <object gid="34" x="1069.62" y="1284.74"/>
   <object gid="33" x="991.872" y="1283.64"/>
+  <object gid="24" x="792.771" y="1282.58"/>
+  <object gid="25" x="856.642" y="1282.58"/>
+  <object gid="28" x="2973.91" y="1794.57"/>
+  <object gid="29" x="3037.72" y="1795.16"/>
  </objectgroup>
  <layer name="Water" width="48" height="32">
   <data>

+ 1 - 1
PhysicsPlatformer/Resources/PhysicsPlatformer.js

@@ -24,7 +24,7 @@ function Start() {
 
 function Update() {
     
-    //physicsWorld.drawDebugGeometry();
+    // physicsWorld.drawDebugGeometry();
 
 }