public void WindowKeyDown(object sender, KeyEventArgs e)
        {
            gameArea.DrawFloor(foxDraw);
            gameArea.DrawWall(foxDraw);

            if (e.Key == Key.Left)
            {
                Console.WriteLine("To the left!");
                myHero.HeroToLeft();
                foxDraw.AddImage("./Assets/hero-left.png", myHero.GetPositionX(), myHero.GetPositionY());
            }

            if (e.Key == Key.Right)
            {
                Console.WriteLine("To the right");
                myHero.HeroToRight();
                foxDraw.AddImage("./Assets/hero-right.png", myHero.GetPositionX(), myHero.GetPositionY());
            }

            if (e.Key == Key.Up)
            {
                Console.WriteLine("Up!");
                myHero.HeroUp();
                foxDraw.AddImage("./Assets/hero-up.png", myHero.GetPositionX(), myHero.GetPositionY());
            }

            if (e.Key == Key.Down)
            {
                Console.WriteLine("Down!");
                myHero.HeroDown();
                foxDraw.AddImage("./Assets/hero-down.png", myHero.GetPositionX(), myHero.GetPositionY());
            }
        }
        public void DrawArea(FoxDraw foxDraw)
        {
            for (int i = 0; i < ColumbNumber; i++)
            {
                for (int j = 0; j < RowNumber; j++)
                {
                    foxDraw.AddImage("./asset/wall.png", i * SideOfTile, j * SideOfTile);
                }
            }

            for (int k = 0; k < ColumbNumber; k++)
            {
                for (int l = 1; l < 3; l++)
                {
                    foxDraw.AddImage("./asset/floor.png", k * SideOfTile, l * 3 * SideOfTile);
                }
            }

            for (int m = 0; m < 3; m++)
            {
                for (int n = 0; n < RowNumber; n++)
                {
                    foxDraw.AddImage("./asset/floor.png", m * 3 * SideOfTile, n * SideOfTile);
                }
            }
        }
        public void Character(Character character)
        {
            Image characterImage = new Image();

            characterImage.Source = new BitmapImage(new Uri(character.GetImage(), UriKind.RelativeOrAbsolute));
            characterImage.Width  = canvas.Width / 10;
            characterImage.Height = canvas.Width / 10;
            foxDraw.AddImage(characterImage, character.GetPosition().X, character.GetPosition().Y);
        }
示例#4
0
 private void DisplayDungeon()
 {
     for (int i = 0; i < Game.Map.Count; i++)
     {
         FoxDraw.AddImage(Game.Map[i].IsWalkable ? "./floor.png" : "./wall.png",
                          Game.Map.TILE_SIZE * Game.Map.XPosition(i),
                          Game.Map.TILE_SIZE * Game.Map.YPosition(i));
     }
     labelAreaInfo.Content = Game.Map.ToString();
 }
示例#5
0
 public void MoveHeroLeft(FoxDraw foxDraw)
 {
     if (Map.floorSurfaceList.Contains(position - 1) && position % 10 != 0)
     {
         foxDraw.AddImage(moveLeftImage, Map.CoordinateCollection[position -= 1]);
     }
     else
     {
         foxDraw.AddImage(moveLeftImage, Map.CoordinateCollection[position]);
     }
 }
示例#6
0
 public void MoveHeroDown(FoxDraw foxDraw)
 {
     if (Map.floorSurfaceList.Contains(position + 10) && position < 90)
     {
         foxDraw.AddImage(moveDownImage, Map.CoordinateCollection[position += 10]);
     }
     else
     {
         foxDraw.AddImage(moveDownImage, Map.CoordinateCollection[position]);
     }
 }
示例#7
0
 public void MoveHeroRight(FoxDraw foxDraw)
 {
     if (Map.floorSurfaceList.Contains(position + 1) && position % 10 != 9)
     {
         foxDraw.AddImage(moveRightImage, Map.CoordinateCollection[position += 1]);
     }
     else
     {
         foxDraw.AddImage(moveRightImage, Map.CoordinateCollection[position]);
     }
 }
示例#8
0
 public void MoveHeroUp(FoxDraw foxDraw)
 {
     if (Map.floorSurfaceList.Contains(position - 10) && position > 9)
     {
         foxDraw.AddImage(moveUpImage, Map.CoordinateCollection[position -= 10]);
     }
     else
     {
         foxDraw.AddImage(moveUpImage, Map.CoordinateCollection[position]);
     }
 }
示例#9
0
 public static void MoveDown(FoxDraw foxDraw)
 {
     if (YCoordinate <= 450 && (XCoordinate == 0 || XCoordinate == 150 || XCoordinate == 300))
     {
         foxDraw.AddImage("./asset/hero-down.png", XCoordinate, YCoordinate + 50);
         YCoordinate += SideOfTile;
     }
     else
     {
         foxDraw.AddImage("./asset/hero-right.png", XCoordinate, YCoordinate);
     }
 }
示例#10
0
 public static void MoveLeft(FoxDraw foxDraw)
 {
     if (XCoordinate >= 50 && (YCoordinate == 150 || YCoordinate == 300))
     {
         foxDraw.AddImage("./asset/hero-left.png", XCoordinate - SideOfTile, YCoordinate);
         XCoordinate -= SideOfTile;
     }
     else
     {
         foxDraw.AddImage("./asset/hero-right.png", XCoordinate, YCoordinate);
     }
 }
示例#11
0
 public static void HeroDown()
 {
     HeroPosition(x, y);
     if (FloorPlan.array[x, y + 1] != 1)
     {
         foxDraw.AddImage("./Assets/hero-down.png", x * 50, (y += 1) * 50);
     }
     else
     {
         foxDraw.AddImage("./Assets/hero-down.png", x * 50, y * 50);
     }
 }
示例#12
0
 public static void MoveUp(FoxDraw foxDraw)
 {
     if (YCoordinate >= 50 && (XCoordinate == 0 || XCoordinate == 150 || XCoordinate == 300))
     {
         foxDraw.AddImage("./asset/hero-up.png", XCoordinate, YCoordinate - 50);
         YCoordinate -= SideOfTile;
     }
     else
     {
         foxDraw.AddImage("./asset/hero-right.png", XCoordinate, YCoordinate);
     }
 }
示例#13
0
        public static void DrawSingleWall(FoxDraw foxDraw, int i, int j)
        {
            int x = i * foxDraw.TILEWIDTH;
            int y = j * foxDraw.TILEHEIGHT;

            foxDraw.AddImage("./Assets/wall.png", x, y);
        }
示例#14
0
        static public List <bool> GenerateRoute(FoxDraw foxDraw, int xmax)
        {
            for (int i = 0; i < field.Count; i++)
            {
                field[i] = true;
            }

            List <int> list = new List <int>()
            {
                3, 5, 13, 15, 17, 18, 21, 22, 23, 25, 27,
                28, 35, 40, 41, 42, 43, 45, 46, 47, 48,
                51, 53, 58, 61, 63, 65, 66, 68, 75, 76,
                78, 81, 82, 83, 88, 93, 95, 96, 98, 101,
                103, 105
            };

            for (int i = 0; i < list.Count; i++)
            {
                field[list[i]] = false;
            }

            for (int i = 0; i < field.Count; i++)
            {
                if (field[i])
                {
                    foxDraw.AddImage("./assets/floor.gif", i % xmax * 50, i / xmax * 50);
                }
            }

            return(field);
        }
示例#15
0
		public MainWindow()
		{
			InitializeComponent();
#if DEBUG
			this.AttachDevTools();
#endif
			canvas = this.Get<Canvas>("canvas");
			foxDraw = new FoxDraw(canvas);

			DispatcherTimer gameClock = new DispatcherTimer();
			gameClock.Interval = new System.TimeSpan(0, 0, 0, 0, 500);
			
			gameClock.Tick += delegate
			{
			};

			gameClock.Start();

			foxDraw.SetBackgroundColor(Colors.Black);

			myFox.Source = new Bitmap("image.png");


			foxDraw.AddImage(myFox, 0, 0);
			
			foxDraw.SetStrokeColor(Colors.White);
			foxDraw.DrawLine(100, 100, 400, 400);
			
		}
示例#16
0
 public void DrawWall(FoxDraw foxDraw)
 {
     foreach (Point point in wallCoordinates)
     {
         foxDraw.AddImage(wallTile, point.X, point.Y);
     }
 }
示例#17
0
        public void MapDraw(FoxDraw foxDraw)
        {
            string[] mapSurface = File.ReadAllLines(@"../../Assets/map.txt");
            floorSurfaceList = mapSurface[0].Split(',').Select(Int32.Parse).ToList();

            for (int i = 0; i < CoordinateCollection.Count; i++)
            {
                if (floorSurfaceList.Contains(i))
                {
                    foxDraw.AddImage(@"../../Assets/floor.png", CoordinateCollection[i]);
                }
                else
                {
                    foxDraw.AddImage(@"../../Assets/wall.png", CoordinateCollection[i]);
                }
            }
        }
示例#18
0
 public void DrawSkeletons(FoxDraw foxDraw)
 {
     for (int i = 0; i < MainWindow.rnd.Next(2, 5); i++)
     {
         int randomNumber = MainWindow.rnd.Next(0, 100);
         foxDraw.AddImage(@"./Assets/skeleton.png", Map.CoordinateCollection[randomNumber]);
     }
 }
示例#19
0
        public static void SetSkeleton(FoxDraw foxDraw)
        {
            int XRandomNumb = rnd.Next(XCoordinateList.Count);
            int YRandomNumb = rnd.Next(YCoordinateList.Count);
            int XCoordinate = XCoordinateList[XRandomNumb];
            int YCoordinate = YCoordinateList[YRandomNumb];

            foxDraw.AddImage("./asset/skeleton.png", XCoordinate, YCoordinate);
        }
示例#20
0
 public void DrawFloor(FoxDraw foxDraw)
 {
     for (int i = 0; i < 10; i++)
     {
         for (int j = 0; j < 11; j++)
         {
             foxDraw.AddImage(floorTile, i * 50, j * 50);
         }
     }
 }
 static public void DrawWalls(FoxDraw foxDraw, int x, int y)
 {
     for (int i = 0; i < x; i++)
     {
         for (int j = 0; j < y; j++)
         {
             foxDraw.AddImage("./assets/wall.gif", i * 50, j * 50);
         }
     }
 }
示例#22
0
        public static void MoveRight()
        {
            foxDraw.AddImage(gameArea.floorPath, gameArea.xCoordinate, gameArea.yCoordinate);

            gameArea.xCoordinate += gameArea.tileSize;
            if (!gameArea.IsMap() || gameArea.isWall())
            {
                gameArea.xCoordinate -= gameArea.tileSize;
            }

            foxDraw.AddImage(pathHeroRight, gameArea.xCoordinate, gameArea.yCoordinate);
        }
示例#23
0
        public Monster(FoxDraw foxDraw, Map map) : base(foxDraw, map)
        {
            PositionOnArray = new Point(7, 7);
            Image.Source    = new Bitmap(@"C:\Users\bajer\Documents\wanderer-cs\img\skeleton.png");
            foxDraw.AddImage(Image, PositionOnArray.X * 72, PositionOnArray.Y * 72);

            /*MaxHP = CurrentHP = 2 * Level * dice.Roll();
             * DefendPoint = Level / 2 * dice.Roll();
             * StrikePoint = Level * dice.Roll();*/
        }
示例#24
0
 public Hero(FoxDraw foxDraw, Map map) : base(foxDraw, map)
 {
     PositionOnArray = new Point(0, 0);
     Image.Source    = new Bitmap(@"C:\Users\bajer\Documents\wanderer-cs\img\hero-down.png");
     foxDraw.AddImage(Image, PositionOnArray.X * 72, PositionOnArray.Y * 72);
     MaxHP       = CurrentHP = 20 + 3 * randomD6;
     DefendPoint = 2 * randomD6;
     StrikePoint = 5 + randomD6;
     CurrentHP   = MaxHP;
 }
示例#25
0
        public Boss(FoxDraw foxDraw, Map map /*, Dice dice*/) : base(foxDraw, map)
        {
            PositionOnArray = new Point(0, 9);
            Image.Source    = new Bitmap(@"C:\Users\bajer\Documents\wanderer-cs\img\boss.png");
            foxDraw.AddImage(Image, PositionOnArray.X * 72, PositionOnArray.Y * 72);

            /*MaxHP = 2 * Level * dice.Roll() + dice.Roll();
             * DefendPoint = Level / 2 * dice.Roll() + dice.Roll() / 2;
             * StrikePoint = Level * dice.Roll() + Level;*/
        }
示例#26
0
        private void AddBrick(FoxDraw foxDraw, string brick, double x, double y)
        {
            string wallBrickPath  = @"C:\Users\bajer\Documents\wanderer-cs\img\wall.png";
            string floorBrickPath = @"C:\Users\bajer\Documents\wanderer-cs\img\floor.png";

            bool isFloor = (brick == "1") ? true : false;

            if (isFloor)
            {
                var image = new Avalonia.Controls.Image();
                image.Source = new Avalonia.Media.Imaging.Bitmap(floorBrickPath);
                foxDraw.AddImage(image, x, y);
            }
            else
            {
                var image = new Avalonia.Controls.Image();
                image.Source = new Avalonia.Media.Imaging.Bitmap(wallBrickPath);
                foxDraw.AddImage(image, x, y);
            }
        }
示例#27
0
        public MainWindow()
        {
            Random rand = new Random();

            InitializeComponent();
            foxDraw = new FoxDraw(canvas);
            //boardTiles = new Tiles();
            boardTileList = Character.TilePositions();
            myHero        = new Hero(0, 0);
            mySkeleton1   = new Skeleton(rand);
            mySkeleton2   = new Skeleton(rand);
            mySkeleton3   = new Skeleton(rand);


            DrawTable();
            foxDraw.AddImage("./Assets/hero-down.png", myHero.positionX, myHero.positionY);
            foxDraw.AddImage("./Assets/skeleton.png", mySkeleton1.positionX, mySkeleton1.positionY);
            foxDraw.AddImage("./Assets/skeleton.png", mySkeleton2.positionX, mySkeleton2.positionY);
            foxDraw.AddImage("./Assets/skeleton.png", mySkeleton3.positionX, mySkeleton3.positionY);
        }
示例#28
0
        public void DrawMap(FoxDraw foxDraw)
        {
            int x = 0;
            int y = 0;

            for (int i = 0; i < GetMap().Count; i++)
            {
                for (int j = 0; j < GetMap()[i].Length; j++)
                {
                    if (GetMap()[i][j] == "true")
                    {
                        foxDraw.AddImage(wallPath, x, y);
                    }
                    else
                    {
                        foxDraw.AddImage(floorPath, x, y);
                    }
                    x += tileSize;
                }
                y += tileSize;
                x  = 0;
            }
        }
示例#29
0
        public static void RandomPositionOfMonster(FoxDraw foxDraw, string path, int maxMonster)
        {
            int numberOfMonster = 0;

            do
            {
                int randomX = random.Next(0, 10);
                int randomY = random.Next(0, 10);
                if (MonsterMatrix()[randomY][randomX] == "false")
                {
                    foxDraw.AddImage(path, randomX * gameArea.tileSize, randomY * gameArea.tileSize);
                    numberOfMonster++;
                    MonsterMatrix()[randomY][randomX] = "true";
                }
            }while (numberOfMonster < maxMonster);
        }
示例#30
0
        static public List <bool> GenerateRandomRoute(FoxDraw foxDraw, int start, int xmax)
        {
            int x = start % xmax;
            int y = start / xmax;

            foxDraw.AddImage("./assets/floor.gif", x * 50, y * 50);
            count--;

            if (count == 0)
            {
                field[start] = true;
                return(field);
            }
            else
            {
                while (!field[start])
                {
                    Random random = new Random();
                    int    index  = random.Next(0, 4);
                    if (index == 0)
                    {
                        if (x > 0 && !(field[start - 1]))
                        {
                            field[start] = true;
                            int step = random.Next(0, 2);
                            if (step == 1)
                            {
                                return(GenerateRandomRoute(foxDraw, start - 1, xmax));
                            }
                        }
                    }
                    if (index == 1)
                    {
                        if (y > 0 && !(field[start - xmax]))
                        {
                            field[start] = true;
                            int step = random.Next(0, 2);
                            if (step == 1)
                            {
                                return(GenerateRandomRoute(foxDraw, start - xmax, xmax));
                            }
                        }
                    }
                    if (index == 2)
                    {
                        if (x < xmax - 1 && !(field[start + 1]))
                        {
                            field[start] = true;
                            int step = random.Next(0, 2);
                            if (step == 1)
                            {
                                return(GenerateRandomRoute(foxDraw, start + 1, xmax));
                            }
                        }
                    }
                    if (index == 3)
                    {
                        if (y < (field.Count / xmax) - 1 && !(field[start + xmax]))
                        {
                            field[start] = true;
                            int step = random.Next(0, 2);
                            if (step == 1)
                            {
                                return(GenerateRandomRoute(foxDraw, start + xmax, xmax));
                            }
                        }
                    }
                }
                return(field);
            }
        }