public void StoppingX() { if (!KeyMouseReader.KeyHeld(Keys.D) && !KeyMouseReader.KeyHeld(Keys.A)) { if (Speed.X < 0.2f && Speed.X > (-0.2f)) { Speed = new Vector2(0, Speed.Y); } if (Speed.X > 0) { Speed = new Vector2(Speed.X - 0.2f, Speed.Y); } if (Speed.X < 0) { Speed = new Vector2(Speed.X + 0.2f, Speed.Y); } } }
public void StoppingY() { if (!KeyMouseReader.KeyHeld(Keys.W) && !KeyMouseReader.KeyHeld(Keys.S)) { if (Speed.Y < 0.2f && Speed.Y > (-0.2f)) { Speed = new Vector2(Speed.X, 0); } if (Speed.Y > 0) { Speed = new Vector2(Speed.X, Speed.Y - 0.2f); } if (Speed.Y < 0) { Speed = new Vector2(Speed.X, Speed.Y + 0.2f); } } }
public void Moving() { if (Speed.X >= (-3) && KeyMouseReader.KeyHeld(Keys.A)) { Speed = new Vector2(Speed.X - 0.6f, Speed.Y); currentDirection = Direction.Left; } else if (Speed.X <= 3 && KeyMouseReader.KeyHeld(Keys.D)) { Speed = new Vector2(Speed.X + 0.6f, Speed.Y); currentDirection = Direction.Right; } else if (Speed.Y >= (-3) && KeyMouseReader.KeyHeld(Keys.W)) { Speed = new Vector2(Speed.X, Speed.Y - 0.6f); currentDirection = Direction.Up; } else if (Speed.Y <= 3 && KeyMouseReader.KeyHeld(Keys.S)) { Speed = new Vector2(Speed.X, Speed.Y + 0.6f); currentDirection = Direction.Down; } }