Ejemplo n.º 1
0
 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);
         }
     }
 }
Ejemplo n.º 2
0
 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);
         }
     }
 }
Ejemplo n.º 3
0
 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;
     }
 }