Пример #1
0
        private void KeyDownEvent(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.D) //right
            {
                double x = FoxDraw.GetLeft(FoxDraw.Tiles[0]) + 10;
                double y = FoxDraw.GetTop(FoxDraw.Tiles[0]) + 0;
                FoxDraw.SetPosition(FoxDraw.Tiles[0], x, y);
            }

            if (e.Key == Key.A) //left
            {
                double x = FoxDraw.GetLeft(FoxDraw.Tiles[0]) - 10;
                double y = FoxDraw.GetTop(FoxDraw.Tiles[0]) + 0;
                FoxDraw.SetPosition(FoxDraw.Tiles[0], x, y);
            }

            if (e.Key == Key.S) //down
            {
                double x = FoxDraw.GetLeft(FoxDraw.Tiles[0]) + 0;
                double y = FoxDraw.GetTop(FoxDraw.Tiles[0]) + 10;
                FoxDraw.SetPosition(FoxDraw.Tiles[0], x, y);
            }

            if (e.Key == Key.W) //up
            {
                double x = FoxDraw.GetLeft(FoxDraw.Tiles[0]) + 0;
                double y = FoxDraw.GetTop(FoxDraw.Tiles[0]) - 10;
                FoxDraw.SetPosition(FoxDraw.Tiles[0], x, y);
            }
        }