Josh Engebretson 11 years ago
parent
commit
654bf8e966
1 changed files with 10 additions and 2 deletions
  1. 10 2
      PhysicsPlatformer/Resources/Components/Avatar.js

+ 10 - 2
PhysicsPlatformer/Resources/Components/Avatar.js

@@ -24,7 +24,7 @@ circle.setRadius(2);
 // Set density
 circle.setDensity(1.0);
 // Set friction.
-circle.setFriction(.1);
+circle.friction = .2;
 // Set restitution
 circle.setRestitution(0.1);
 
@@ -117,8 +117,16 @@ function handleInput(timeStep) {
     if (!left && !right) {
         vel[0] *= 0.9;
         body.linearVelocity = vel;
+        circle.friction = 1000.0;
     }
-
+    else
+    {
+       circle.friction = .2;    
+    }
+   
+    if (!contactCount)
+        circle.friction = 0.0;
+    
     if (jump && contactCount) {
         vel[1] = 0;
         body.linearVelocity = vel;