Beispiel #1
0
 public void Update()
 {
     KeyboardState keyState = Keyboard.GetState ();
     if (keyState.IsKeyDown (Keys.Up)) {
         velocity = 2;
         direction.X = 0;
         direction.Y = -1;
         texture = back;
     } else if (keyState.IsKeyDown (Keys.Down)) {
         velocity = 2;
         direction.X = 0;
         direction.Y = 1;
         texture = front;
     } else if (keyState.IsKeyDown (Keys.Left)) {
         velocity = 2;
         direction.X = -1;
         direction.Y = 0;
         texture = left;
     } else if (keyState.IsKeyDown (Keys.Right)) {
         velocity = 2;
         direction.X = 1;
         direction.Y = 0;
         texture = right;
     } else {
         velocity = 0;
     }
 }
Beispiel #2
0
        public void Update()
        {
            KeyboardState keyState = Keyboard.GetState();

            if (keyState.IsKeyDown(Keys.Up))
            {
                velocity    = 2;
                direction.X = 0;
                direction.Y = -1;
                texture     = back;
            }
            else if (keyState.IsKeyDown(Keys.Down))
            {
                velocity    = 2;
                direction.X = 0;
                direction.Y = 1;
                texture     = front;
            }
            else if (keyState.IsKeyDown(Keys.Left))
            {
                velocity    = 2;
                direction.X = -1;
                direction.Y = 0;
                texture     = left;
            }
            else if (keyState.IsKeyDown(Keys.Right))
            {
                velocity    = 2;
                direction.X = 1;
                direction.Y = 0;
                texture     = right;
            }
            else
            {
                velocity = 0;
            }
        }
Beispiel #3
0
 public Player()
 {
     texture = front;
 }
Beispiel #4
0
 public Player()
 {
     texture = front;
 }