Fixed bug where player tripped out when standing on ground.

This commit is contained in:
Jeasonfire 2015-05-10 01:14:08 +03:00
parent 71a2ce2b40
commit 1136a9b8b8

View File

@ -30,6 +30,9 @@ public class PhysicsSystem extends EntitySystem {
for (int i = 0; i < entities.size(); i++) { for (int i = 0; i < entities.size(); i++) {
CPhysics obj = pm.get(entities.get(i)); CPhysics obj = pm.get(entities.get(i));
// Apply movement
obj.position.add(obj.velocity);
// Movement // Movement
if (obj.movable) { if (obj.movable) {
float move = 0; float move = 0;
@ -62,9 +65,6 @@ public class PhysicsSystem extends EntitySystem {
collision(entities.get(i), entities.get(j)); collision(entities.get(i), entities.get(j));
} }
} }
// Apply movement
obj.position.add(obj.velocity);
} }
} }
@ -116,7 +116,7 @@ public class PhysicsSystem extends EntitySystem {
cp0.velocity.y = 0; cp0.velocity.y = 0;
} }
cp0.grounded = true; cp0.grounded = true;
cp0.position.y += (y11 - y00) * 1.1f; cp0.position.y += y11 - y00;
if (cp0.collisionListener != null) { if (cp0.collisionListener != null) {
cp0.collisionListener.collision(CollisionSide.BOTTOM, entity0, entity1); cp0.collisionListener.collision(CollisionSide.BOTTOM, entity0, entity1);