Ejemplo n.º 1
0
        public void Play()
        {
            string stop = "a";

            Lvl1.Draw();
            while (stop != "x")
            {
                stop = Console.ReadLine();

                if (stop == "a") //move left
                {
                    Deku.MoveLeft();
                }
                else if (stop == "w") //move up
                {
                    Deku.MoveUp();
                }
                else if (stop == "d") //move right
                {
                    Deku.MoveRight();
                }
                else if (stop == "s")//move dwon
                {
                    Deku.MoveDown();
                }
                //rysowanie mapy
                Lvl1.Draw();


                Console.WriteLine(stop);
            }
        }
Ejemplo n.º 2
0
        private void WindowKeyDown(object sender, KeyEventArgs e)
        {
            var foxDraw = new FoxDraw(canvas);

            area.DrawArea(foxDraw);

            if (e.Key == Key.Left)
            {
                Hero.MoveLeft(foxDraw);
            }

            if (e.Key == Key.Right)
            {
                Hero.MoveRight(foxDraw);
            }

            if (e.Key == Key.Up)
            {
                Hero.MoveUp(foxDraw);
            }

            if (e.Key == Key.Down)
            {
                Hero.MoveDown(foxDraw);
            }
        }