protected virtual void updateX(float step_time, cWorld world) { acceleration.X = force.X; velocity.X += acceleration.X * step_time; if (acceleration.X < 0.0f) { velocity.X = AppMath.Max <float>(velocity.X, -this.maxWalkSpeed); } else if (acceleration.X > 0.0f) { velocity.X = AppMath.Min <float>(velocity.X, this.maxWalkSpeed); } else // if (isOnGround) { velocity.X = isOnGround ? velocity.X * Constants.GROUND_SLOW_DOWN_FACTOR : velocity.X * Constants.AIR_SLOW_DOWN_FACTOR; } velocity.X = Math.Abs(velocity.X) <= 0.05f ? 0.0f : velocity.X; float delta = velocity.X * step_time; if (delta <= 0.0f) { float wallRightX; if (hasLeftWall2(world, delta, out wallRightX)) { position.X = wallRightX; velocity.X = 0.0f; } else { position.X += delta; } } else { float wallLeftX; if (hasRightWall2(world, delta, out wallLeftX)) { position.X = wallLeftX - Bounds.dims.X; velocity.X = 0.0f; } else { position.X += delta; } } }