コード例 #1
0
 public void DrawMap()
 {
     for (int i = 1; i <= n; i++)
     {
         for (int j = 1; j <= n; j++)
         {
             x += 50;
             foxDraw.AddImage(@"../../Assets/floor.png", x, y);
         }
         y += 50;
         x  = 0;
     }
 }
コード例 #2
0
 public static void MoveLeft(FoxDraw foxDraw)
 {
     if (XCoord > 50)
     {
         XCoord -= 50;
     }
     foxDraw.AddImage(pathheroleft, XCoord, YCoord);
 }
コード例 #3
0
 public static void MoveUp(FoxDraw foxDraw)
 {
     if (YCoord > 50)
     {
         YCoord -= 50;
     }
     foxDraw.AddImage(patheroup, XCoord, YCoord);
 }
コード例 #4
0
 public void WalkLeft(FoxDraw foxDraw)
 {
     if (pointX > 50 && map.Field[(pointY - 50) / 50][(pointX - 50) / 50 - 1])
     {
         pointX -= moveMent;
     }
     foxDraw.AddImage(HeroLeft, pointX, pointY);
 }
コード例 #5
0
 public static void MoveDown(FoxDraw foxDraw)
 {
     if (YCoord < 500)
     {
         YCoord += 50;
     }
     foxDraw.AddImage(pathherodown, XCoord, YCoord);
 }
コード例 #6
0
 public void WalkRight(FoxDraw foxDraw)
 {
     if (pointX < 500 && map.Field[(pointY - 50) / 50][(pointX - 50) / 50 + 1])
     {
         pointX += moveMent;
     }
     foxDraw.AddImage(HeroRight, pointX, pointY);
 }
コード例 #7
0
 public void WalkUp(FoxDraw foxDraw)
 {
     if (pointY > 50 && map.Field[(pointY - 50) / 50 - 1][(pointX - 50) / 50])
     {
         pointY -= moveMent;
     }
     foxDraw.AddImage(HeroUp, pointX, pointY);
 }
コード例 #8
0
 public void WalkDown(FoxDraw foxDraw)
 {
     if (pointY < 500 && map.Field[(pointY - 50) / 50 + 1][(pointX - 50) / 50])
     {
         pointY += moveMent;
     }
     foxDraw.AddImage(HeroDown, pointX, pointY);
 }
コード例 #9
0
 public Hero(FoxDraw foxDraw)
 {
     this.currentHP = maxHP;
     this.maxHP     = 20 + 3 * RollDice();
     this.DP        = 2 * RollDice();
     this.SP        = 5 * RollDice();
     foxDraw.AddImage("./Assets/hero-down.png", startingX, startingY);
 }
コード例 #10
0
 public static void MoveRight(FoxDraw foxDraw)
 {
     if (XCoord < 500)
     {
         XCoord += 50;
     }
     foxDraw.AddImage(pathheroright, XCoord, YCoord);
 }
コード例 #11
0
 public static void HeroUp(FoxDraw foxDraw)
 {
     if (Tile.Matrix[startingY / boardsize - 1][startingX / boardsize])
     {
         Tile.DrawTile(foxDraw, startingX, startingY);
         startingY -= boardsize;
     }
     foxDraw.AddImage("./Assets/hero-up.png", startingX, startingY);
 }
コード例 #12
0
 public static void HeroRight(FoxDraw foxDraw)
 {
     if (Tile.Matrix[startingY / boardsize][startingX / boardsize + 1])
     {
         Tile.DrawTile(foxDraw, startingX, startingY);
         startingX += boardsize;
     }
     foxDraw.AddImage("./Assets/hero-right.png", startingX, startingY);
 }
コード例 #13
0
        public Boss(FoxDraw foxDraw)
        {
            int number = 1;

            this.currentHP = maxHP;
            this.maxHP     = 2 * number * RollDice() + RollDice();
            this.DP        = 2 * number / 2 * RollDice() + RollDice();
            this.SP        = 5 * number * RollDice() + number;
            foxDraw.AddImage("./Assets/boss.png", 500, 50);
        }
コード例 #14
0
        public void WindowKeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Left)
            {
                if (hero.x > 0)
                {
                    hero.x -= 50;
                    hero.AppearHero();
                    foxDraw.AddImage(@"../../Assets/hero-left.png", hero.x, hero.y);
                }
            }

            if (e.Key == Key.Right)
            {
                if (hero.x < 500)
                {
                    hero.x += 50;
                    hero.AppearHero();
                    foxDraw.AddImage(@"../../Assets/hero-right.png", hero.x, hero.y);
                    //foxDraw.SetPosition(hero.x, hero.y);
                }
            }

            if (e.Key == Key.Up)
            {
                if (hero.y > 0)
                {
                    hero.y -= 50;
                    hero.AppearHero();
                    foxDraw.AddImage(@"../../Assets/hero-up.png", hero.x, hero.y);
                }
            }

            if (e.Key == Key.Down)
            {
                if (hero.y < 500)
                {
                    hero.y += 50;
                    hero.AppearHero();
                    foxDraw.AddImage(@"../../Assets/hero-down.png", hero.x, hero.y);
                }
            }
        }
コード例 #15
0
        public void AddImages(FoxDraw foxDraw)
        {
            foreach (Characters character in ListOfCharacters)
            {
                if (character.Type == "Hero")
                {
                    foxDraw.AddImage("./hero-down.png", character.XCoordinate, character.YCoordinate);
                }

                if (character.Type == "Boss")
                {
                    foxDraw.AddImage("./boss.png", character.XCoordinate, character.YCoordinate);
                }

                if (character.Type == "Skeleton")
                {
                    foxDraw.AddImage("./skeleton.png", character.XCoordinate, character.YCoordinate);
                }
            }
        }
コード例 #16
0
 public void MapDrawer(FoxDraw foxDraw)
 {
     for (int i = 0; i < Field.Count; i++)
     {
         x  = 0;
         y += gameField;
         for (int j = 0; j < Field.Count; j++)
         {
             x += gameField;
             if (Field[i][j])
             {
                 foxDraw.AddImage(floorS, x, y);
             }
             else
             {
                 foxDraw.AddImage(wallS, x, y);
             }
         }
     }
 }
コード例 #17
0
        public static void DrawMap(FoxDraw foxDraw)
        {
            int y = 0;
            int x = 0;

            for (int i = 1; i < matrix.Count - 1; i++)
            {
                y = i * boardsize;
                for (int j = 1; j < matrix.Count - 1; j++)
                {
                    x = j * boardsize;
                    if (matrix[i][j] == true)
                    {
                        foxDraw.AddImage("./Assets/floor.png", x, y);
                    }
                    else
                    {
                        foxDraw.AddImage("./Assets/wall.png", x, y);
                    }
                }
            }
        }
コード例 #18
0
        public static void DrawMap(FoxDraw foxDraw)
        {
            int x  = 0;
            int y  = 0;
            int x2 = 0;
            int y2 = 0;

            StreamReader myReader = new StreamReader(@"\\Mac\Home\Documents\greenfox\evelinhlacsok-RPG\wanderer-rpg\wanderer-rpg\Assets\map.txt");
            string       line     = "";

            while (line != null)
            {
                line = myReader.ReadLine();
                y    = y + 50;
                y2   = y2 + 1;
                x    = 0;
                x2   = 0;
                if (line != null)
                {
                    string[] letters = line.Split(' ');
                    foreach (var letter in letters)
                    {
                        x  = x + 50;
                        x2 = x2 + 1;
                        if (letter == "w")
                        {
                            foxDraw.AddImage("./Assets/wall.png", x, y);
                            matrix[x2 - 1, y2 - 1] = 1;
                        }
                        else
                        {
                            matrix[x / 50 - 1, y / 50 - 1] = 0;
                            foxDraw.AddImage("./Assets/floor.png", x, y);
                        }
                    }
                }
            }
        }
コード例 #19
0
        public void PlaceEnemy(FoxDraw foxDraw, Random rnd, List <bool[]> matrixForSkeleton, int tilesize)
        {
            bool placingIsSuccesful = false;

            do
            {
                int x = rnd.Next(1, 11);
                int y = rnd.Next(1, 11);
                if (matrixForSkeleton[y][x] == true)
                {
                    placingIsSuccesful = true;
                    foxDraw.AddImage("./Assets/skeleton.png", x * tilesize, y * tilesize);
                    matrixForSkeleton[y][x] = false;
                }
            } while (!placingIsSuccesful);
        }
コード例 #20
0
        public void Drawskeleton(FoxDraw foxDraw)
        {
            Skeleton.foxDraw = foxDraw;
            int noOfSkeleton = 0;

            do
            {
                int x = randomSkeleton.Next(1, 11);
                int y = randomSkeleton.Next(1, 11);
                if (skeletonMatrix[y][x] == true)
                {
                    foxDraw.AddImage("./Assets/skeleton.png", startingSkeletonX * x, startingSkeletonY * y);
                    noOfSkeleton++;
                    skeletonMatrix[y][x] = false;
                }
            } while (noOfSkeleton < 3);
        }
コード例 #21
0
        public void Drawboss(FoxDraw foxDraw)
        {
            Boss.foxDraw = foxDraw;
            Random randomBoss = new Random();

            bool isPlace = false;

            do
            {
                int x = randomBoss.Next(1, 11);
                int y = randomBoss.Next(1, 11);
                if (Skeleton.skeletonMatrix[y][x] == true)
                {
                    foxDraw.AddImage("./Assets/boss.png", startingBossX * x, startingBossY * y);
                    isPlace = true;
                }
            } while (isPlace != true);
        }
コード例 #22
0
 public void Drawhero(FoxDraw foxDraw)
 {
     Hero.foxDraw = foxDraw;
     foxDraw.AddImage("./Assets/hero-down.png", startingHeroX, startingHeroY);
 }
コード例 #23
0
 public void AppearHero()
 {
     foxDraw.AddImage(@"../../Assets/hero.png", x, y);
 }
コード例 #24
0
 public void HeroDrawer(FoxDraw foxDraw)
 {
     foxDraw.AddImage(HeroDown, pointX, pointY);
 }
コード例 #25
0
 public static void SetHero(FoxDraw foxDraw)
 {
     Hero.foxDraw = foxDraw;
     foxDraw.AddImage(pathherodown, 50, 50);
 }
コード例 #26
0
 public static void DrawTile(FoxDraw foxDraw, int x, int y)
 {
     foxDraw.AddImage("./Assets/floor.png", x, y);
 }