Beispiel #1
0
        public override void Move(Canvas canvas, int number)
        {
            Map map = new Map();

            map.Read();
            if (number == 1 && PosY / 50 < 9 && map.content[PosY / 50 + 1][PosX / 50] == '0')
            {
                PosY += 50;
            }
            if (number == 2 && PosX / 50 < 9 && map.content[PosY / 50][PosX / 50 + 1] == '0')
            {
                PosX += 50;
            }
            if (number == 3 && PosY / 50 > 0 && map.content[PosY / 50 - 1][PosX / 50] == '0')
            {
                PosY -= 50;
            }
            if (number == 4 && PosX / 50 > 0 && map.content[PosY / 50][PosX / 50 - 1] == '0')
            {
                PosX -= 50;
            }
            FoxDraw foxDraw = new FoxDraw(canvas);

            foxDraw.AddImage("img/skeleton.png", PosX, PosY);
        }
Beispiel #2
0
 public void MoveDown(FoxDraw foxDraw)
 {
     if (startY < max && map.bricks[(startY - 50) / size + 1][(startX - 50) / size])
     {
         startY += size;
     }
     foxDraw.AddImage(heroImage, startX, startY);
 }
Beispiel #3
0
 public void MoveUp(FoxDraw foxDraw)
 {
     if (startY > size && map.bricks[(startY - 50) / size - 1][(startX - 50) / size])
     {
         startY -= size;
     }
     foxDraw.AddImage(heroUp, startX, startY);
 }
Beispiel #4
0
 public void MoveRight(FoxDraw foxDraw)
 {
     if (startX < max && map.bricks[(startY - 50) / size][(startX - 50) / size + 1])
     {
         startX += size;
     }
     foxDraw.AddImage(heroRight, startX, startY);
 }
Beispiel #5
0
 public void MoveLeft(FoxDraw foxDraw)
 {
     if (startX > size && map.bricks[(startY - 50) / size][(startX - 50) / size - 1])
     {
         startX -= size;
     }
     foxDraw.AddImage(heroLeft, startX, startY);
 }
Beispiel #6
0
 public void MapCreator(FoxDraw foxDraw)
 {
     for (int i = 0; i < 10; i++)
     {
         y += size;
         x  = 0;
         for (int j = 0; j < 10; j++)
         {
             x += size;
             if (bricks[i][j] == true)
             {
                 foxDraw.AddImage(tile, x, y);
             }
             else
             {
                 foxDraw.AddImage(wall, x, y);
             }
         }
     }
 }
Beispiel #7
0
        public override void DrawMonster(Canvas canvas)
        {
            Map map = new Map();

            map.Read();
            var foxDraw = new FoxDraw(canvas);

            while ('0' != map.content[PosY / 50][PosX / 50] || PosX == 0 && PosY == 0)
            {
                PosY = rand.Next(0, 10) * 50;
                PosX = rand.Next(0, 10) * 50;
            }
            foxDraw.AddImage("img/skeleton.png", PosX, PosY);
        }
Beispiel #8
0
        public void MoveMonsters(Canvas canvas, Hero hero)
        {
            Random rnd = new Random();

            if (hero.stepCounter % 2 == 0)
            {
                foreach (var monster in characters)
                {
                    monster.Move(canvas, rnd.Next(1, 5));
                }
            }
            foreach (var monster in characters)
            {
                FoxDraw foxDraw = new FoxDraw(canvas);
                foxDraw.AddImage("img/skeleton.png", monster.PosX, monster.PosY);
            }
        }
Beispiel #9
0
        public override void DrawMonster(Canvas canvas)
        {
            Map map = new Map();

            map.Read();
            var     foxDraw = new FoxDraw(canvas);
            Tile    tile    = new Tile();
            Monster monster = new Monster();
            Hero    hero    = new Hero();

            while ('0' != map.content[PosY / 50][PosX / 50] || hero.GetPosition(hero.PosX, hero.PosY) == GetPosition(PosX, PosY))
            {
                Random sss = new Random();
                PosY = sss.Next(0, 10) * 50;
                PosX = sss.Next(0, 10) * 50;
            }
            foxDraw.AddImage("img/boss.png", PosX, PosY);
        }
Beispiel #10
0
        //public bool IsInMap()
        //{
        //    return !(startX > max || startY > max || startY < 0 || startX < 0);
        //}

        public void HeroAdder(FoxDraw foxDraw)
        {
            foxDraw.AddImage(heroImage, startX, startY);
        }
Beispiel #11
0
        public void DrawHeroUp(Canvas canvas)
        {
            var foxDraw = new FoxDraw(canvas);

            foxDraw.AddImage("img/hero-Up.png", PosX, PosY);
        }