diff --git a/Jumpy.Shared/Player.cs b/Jumpy.Shared/Player.cs index f0ea924..3386096 100644 --- a/Jumpy.Shared/Player.cs +++ b/Jumpy.Shared/Player.cs @@ -13,7 +13,6 @@ namespace Jumpy { private Texture2D texture; private const int spriteSize = 48; private const int spriteWidth = 7; - private const int bottomPadding = 1; private const int moveSpeed = 150; private const int jumpSpeed = 500; private const int gravity = 1500; @@ -30,23 +29,18 @@ namespace Jumpy { this.texture = texture; } - // TODO: refactor input to have a virtual "which directions & buttons were being pressed" - // instead of complicated if-statements in this function. public void Update( GameTime time, History gamePad, List collisionTargets) { Point oldPosition = position; AirState oldAirState = airState; UpdateFromGamePad(time, gamePad); - bool someIntersection = false; - Rectangle playerBbox = new Rectangle(position.X - spriteWidth, position.Y - 8, spriteWidth * 2, 27); bool standingOnGround = false; foreach (var rect in collisionTargets) { playerBbox = new Rectangle(position.X - spriteWidth, position.Y - 8, spriteWidth * 2, 27); if (playerBbox.Intersects(rect)) { - someIntersection = true; if (oldPosition.Y > position.Y) { int diff = playerBbox.Top - rect.Bottom; position.Y -= diff; @@ -85,6 +79,8 @@ namespace Jumpy { } } + // TODO: refactor input to have a virtual "which directions & buttons were being pressed" + // instead of complicated if-statements in this function. void UpdateFromGamePad(GameTime time, History gamePad) { if (gamePad[0].IsButtonDown(Buttons.A) && airState == AirState.Ground) { pose = Pose.Jumping;