Ejemplo n.º 1
0
 public Tower(double x, double y)
 {
     HealRecharged = LostHealth = false;
     Cycles        = Frame = 0;
     HealFrame     = 0;
     Coordinates   = new Vector(x, y);
     HealthAmount  = 50;
     HealthImage   = GetHealthImage();
     ImgInfo       = new ImageInfo(103, 198, 5);
     HealImage     = GameMethods.GetImageByName("heal_spriteslist");
     HealImgInfo   = new ImageInfo(52, 42, 7);
 }
Ejemplo n.º 2
0
 public Game()
 {
     SpriteSheets    = GameMethods.GetSpriteSheets();
     KeysImages      = GameMethods.GetKeys();
     MapImage        = GameMethods.GetImageByName("map");
     GateCoordinates = new Vector[]
     {
         new Vector(275, 85),
         new Vector(640, 85),
         new Vector(1005, 85)
     };
     PlayerTower    = new Tower(631.5, 400);
     CurrentWave    = 4;
     Randomizer     = new Random();
     Monsters       = this.CreateRandomMonstersAsync(1);
     IsGameFinished = false;
     MonsterToAdd   = new Queue <Monster>();
 }
Ejemplo n.º 3
0
        private Image GetHealthImage()
        {
            int firstDigit = HealthAmount / 10;
            var lastDigit  = HealthAmount % 10;

            if (HealthAmount > 0)
            {
                if (lastDigit == 0 || lastDigit > 5)
                {
                    if (firstDigit > 0 && lastDigit == 0)
                    {
                        return(GameMethods.GetImageByName($"_{(firstDigit - 1) * 10 + 6}___{firstDigit * 10}"));
                    }
                    else if (firstDigit > 0 && lastDigit > 0)
                    {
                        return(GameMethods.GetImageByName($"_{firstDigit * 10 + 6}___{(firstDigit + 1) * 10}"));
                    }
                    else
                    {
                        return(GameMethods.GetImageByName($"_6___10"));
                    }
                }
                else if (firstDigit > 0)
                {
                    return(GameMethods.GetImageByName($"_{firstDigit * 10 + 1}___{firstDigit * 10 + 5}"));
                }
                else
                {
                    return(GameMethods.GetImageByName($"_1___5"));
                }
            }
            else
            {
                return(GameMethods.GetImageByName("_0"));
            }
        }