From d9ed88a9efa2a6d17565cb9a2946769ea5b83810 Mon Sep 17 00:00:00 2001 From: Colin McMillen Date: Sun, 8 Dec 2019 09:58:56 -0500 Subject: [PATCH] dpad support GitOrigin-RevId: 9c28c2defa0c5222a5ffd10e09648d6041f146ef --- Jumpy.Shared/Player.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Jumpy.Shared/Player.cs b/Jumpy.Shared/Player.cs index 13adc6a..97d9196 100644 --- a/Jumpy.Shared/Player.cs +++ b/Jumpy.Shared/Player.cs @@ -30,17 +30,17 @@ namespace Jumpy { return; } Vector2 leftStick = gamePad.ThumbSticks.Left; - if (leftStick.X < -0.5) { + if (gamePad.DPad.Left == ButtonState.Pressed || leftStick.X < -0.5) { facing = Facing.Left; pose = Pose.Walking; position.X -= moveSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds; - } else if (leftStick.X > 0.5) { + } else if (gamePad.DPad.Right == ButtonState.Pressed || leftStick.X > 0.5) { facing = Facing.Right; pose = Pose.Walking; position.X += moveSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds; - } else if (leftStick.Y < -0.5) { + } else if (gamePad.DPad.Down == ButtonState.Pressed || leftStick.Y < -0.5) { pose = Pose.Crouching; - } else if (leftStick.Y > 0.5) { + } else if (gamePad.DPad.Up == ButtonState.Pressed || leftStick.Y > 0.5) { pose = Pose.Stretching; } else { pose = Pose.Standing;