Beispiel #1
0
 private void miCanvas_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Up && DirreccionJugador == Dirrecion.Arriba)
     {
         DirreccionJugador = Dirrecion.Ninguna;
     }
     if (e.Key == Key.Down && DirreccionJugador == Dirrecion.Abajo)
     {
         DirreccionJugador = Dirrecion.Ninguna;
     }
     if (e.Key == Key.Left && DirreccionJugador == Dirrecion.Izquierda)
     {
         DirreccionJugador = Dirrecion.Ninguna;
     }
     if (e.Key == Key.Right && DirreccionJugador == Dirrecion.Derecha)
     {
         DirreccionJugador = Dirrecion.Ninguna;
     }
 }
Beispiel #2
0
        private void miCanvas_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Right)
            {
                DirreccionJugador = Dirrecion.Derecha;
            }

            if (e.Key == Key.Left)
            {
                DirreccionJugador = Dirrecion.Izquierda;
            }

            if (e.Key == Key.Up)
            {
                DirreccionJugador = Dirrecion.Arriba;
            }
            if (e.Key == Key.Down)
            {
                DirreccionJugador = Dirrecion.Abajo;
            }
        }