dpad support

GitOrigin-RevId: 9c28c2defa0c5222a5ffd10e09648d6041f146ef
This commit is contained in:
Colin McMillen 2019-12-08 09:58:56 -05:00
parent 050a5b0567
commit d9ed88a9ef

View File

@ -30,17 +30,17 @@ namespace Jumpy {
return; return;
} }
Vector2 leftStick = gamePad.ThumbSticks.Left; Vector2 leftStick = gamePad.ThumbSticks.Left;
if (leftStick.X < -0.5) { if (gamePad.DPad.Left == ButtonState.Pressed || leftStick.X < -0.5) {
facing = Facing.Left; facing = Facing.Left;
pose = Pose.Walking; pose = Pose.Walking;
position.X -= moveSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds; 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; facing = Facing.Right;
pose = Pose.Walking; pose = Pose.Walking;
position.X += moveSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds; 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; pose = Pose.Crouching;
} else if (leftStick.Y > 0.5) { } else if (gamePad.DPad.Up == ButtonState.Pressed || leftStick.Y > 0.5) {
pose = Pose.Stretching; pose = Pose.Stretching;
} else { } else {
pose = Pose.Standing; pose = Pose.Standing;