Exemple #1
0
 public Fiende(Game1 game, Sprite spriteSheet)
     : base(game, spriteSheet)
 {
     this.gubbe = game.Player1;
     lever = true;
     drawLayer = 0.5f;
 }
Exemple #2
0
 public LavaEnemy(Game1 game, Sprite spriteSheet)
     : base(game, spriteSheet)
 {
     bild = spriteSheet.GetSubSprite(new Rectangle(249, 5, 20, 20));
     hastighet = 1;
     movement = FiendeMovement.Follow;
     liv = 30;
     skada = 1;
 }
Exemple #3
0
        public LevelTest(Game1 game, Sprite spriteSheet, Random random1)
            : base()
        {
            spelObjektLista = new List<SpelObjekt>();

            StoneTowerBoss f1 = new StoneTowerBoss(game, spriteSheet);
            f1.Position = new Vector2(300, 300);
            spelObjektLista.Add(f1);
        }
Exemple #4
0
        public Mina(Game1 game, Sprite spriteSheet)
            : base(game, spriteSheet)
        {
            bild = spriteSheet.GetSubSprite(new Rectangle(85, 4, 27, 22));
            movement = FiendeMovement.Static;
            immobile = true;

            liv = 1;
            skada = 10;
        }
Exemple #5
0
 public StoneTower(Game1 game, Sprite spriteSheet)
     : base(game, spriteSheet)
 {
     bild = spriteSheet.GetSubSprite(new Rectangle(275, 7, 39, 39));
     hastighet = 0;
     movement = FiendeMovement.Static;
     liv = 200;
     skada = 1;
     immobile = true;
 }
Exemple #6
0
        public Level2(Game1 game, Sprite spriteSheet, Random random1)
            : base()
        {
            spelObjektLista = new List<SpelObjekt>();

            //Boss
            FirstBoss f1 = new FirstBoss(game, spriteSheet);
            f1.Position = new Vector2(random1.Next(870), random1.Next(670));
            spelObjektLista.Add(f1);
        }
Exemple #7
0
 public FiendeTorn(Game1 game, Sprite spriteSheet)
     : base(game, spriteSheet)
 {
     bild = spriteSheet.GetSubSprite(new Rectangle(50, 0, 29, 29));
     hastighet = 0;
     movement = FiendeMovement.Follow;
     liv = 100;
     skada = 1;
     immobile = true;
 }
Exemple #8
0
 public StoneTowerBoss(Game1 game, Sprite spriteSheet)
     : base(game, spriteSheet)
 {
     bild = spriteSheet.GetSubSprite(new Rectangle(394,4,70,70));
     hastighet = 0;
     movement = FiendeMovement.Follow;
     liv = 2500;
     skada = 1;
     immobile = true;
 }
Exemple #9
0
        public LavaPool(Game1 game, Sprite spriteSheet)
            : base(game, spriteSheet)
        {
            this.game = game;
            this.spriteSheet = spriteSheet;

            bild = spriteSheet.GetSubSprite(new Rectangle(344, 3, 38, 35));
            Position = new Vector2(-100, -100);
            hastighet = 0;
            liv = 1000;
            skada = 1;
        }
        public StoneTowerBossStenBumling(Game1 game, Sprite spriteSheet, RunningState presentState)
            : base(game, spriteSheet)
        {
            this.game = game;
            this.spriteSheet = spriteSheet;

            bild = spriteSheet.GetSubSprite(new Rectangle(329, 36, 20, 20));
            Position = new Vector2(-100, -100);
            hastighet = 2;
            liv = 1;
            skada = 30;
        }
Exemple #11
0
        public BigEnemyStone(Game1 game, Sprite spriteSheet)
            : base(game, spriteSheet)
        {
            this.game = game;
            this.spriteSheet = spriteSheet;

            bild = spriteSheet.GetSubSprite(new Rectangle(324, 21, 13, 13));
            Position = new Vector2(-100, -100);
            hastighet = 3;
            liv = 1;
            skada = 20;
        }
Exemple #12
0
        public LavaSkott(Game1 game, Sprite spriteSheet)
            : base(game, spriteSheet)
        {
            this.game = game;
            this.spriteSheet = spriteSheet;

            bild = spriteSheet.GetSubSprite(new Rectangle(249, 28, 5, 5));
            Position = new Vector2(-100, -100);
            hastighet = 4;
            liv = 1;
            skada = 1;
        }
Exemple #13
0
        public VanligtFiendeSkott(Game1 game, Sprite spriteSheet, RunningState presentState)
            : base(game, spriteSheet)
        {
            this.game = game;
            this.spriteSheet = spriteSheet;

            bild = spriteSheet.GetSubSprite(new Rectangle(40, 5, 5, 5));
            Position = new Vector2(-100, -100);
            hastighet = 5;
            liv = 1;
            skada = 5;
        }
        public StoneTowerBossSpawnSkott(Game1 game, Sprite spriteSheet)
            : base(game, spriteSheet)
        {
            this.game = game;
            this.spriteSheet = spriteSheet;

            bild = spriteSheet.GetSubSprite(new Rectangle(354, 42, 5, 5));
            Position = new Vector2(-100, -100);
            hastighet = 10;
            liv = 1;
            skada = 1;
        }
Exemple #15
0
        public Level3(Game1 game, Sprite spriteSheet, Random random1)
            : base()
        {
            spelObjektLista = new List<SpelObjekt>();

            for (int n = 0; n < 50; n++)
            {
                VanligFiende f1 = new VanligFiende(game, spriteSheet);
                f1.Position = new Vector2(random1.Next(870), random1.Next(670));
                f1.SetRandomDirection(random1);
                spelObjektLista.Add(f1);
            }
        }
        public StoneTowerBossSpawnedTower(Game1 game, Sprite spriteSheet)
            : base(game, spriteSheet)
        {
            this.game = game;
            this.spriteSheet = spriteSheet;

            bild = spriteSheet.GetSubSprite(new Rectangle(370, 48, 20, 20));
            Position = new Vector2(-100, -100);
            movement = FiendeMovement.Follow;
            hastighet = 0;
            liv = 100;
            skada = 1;
        }
Exemple #17
0
        public Level6(Game1 game, Sprite spriteSheet, Random random1)
            : base()
        {
            spelObjektLista = new List<SpelObjekt>();

            for (int n = 0; n < 20; n++)
            {
                LavaEnemy f1 = new LavaEnemy(game, spriteSheet);
                f1.Position = new Vector2(random1.Next(870), random1.Next(670));
                f1.SetRandomDirection(random1);
                spelObjektLista.Add(f1);
            }
        }
Exemple #18
0
        public MinFiende(Game1 game, Sprite spriteSheet)
            : base(game, spriteSheet)
        {
            bild = spriteSheet.GetSubSprite(new Rectangle(117, 0, 18, 27));
            hastighet = 1.5F;
            movement = FiendeMovement.Common;

            liv = 30;
            skada = 1;

            Random random = new Random();
            riktning = new Vector2((float)(random.NextDouble() * 2 - 1),
                (float)(random.NextDouble() * 2 - 1));
            riktning = GlobalFunctions.ScaleDirection(riktning);
        }
Exemple #19
0
        public BigStoneSkott(Game1 game, Sprite spriteSheet)
            : base(game, spriteSheet)
        {
            this.game = game;
            this.spriteSheet = spriteSheet;

            bild = spriteSheet.GetSubSprite(new Rectangle(324, 21, 13, 13));
            position = new Vector2(-100, -100);
            hastighet = 2;
            liv = 10000;
            skada = 100;
            energiKostnad = 50;
            range = 400;
            oneTimeDamageLista = new List<SpelObjekt>();
        }
Exemple #20
0
        public FirstBoss(Game1 game, Sprite spriteSheet)
            : base(game, spriteSheet)
        {
            //importera ny spriteSheet
            bild = spriteSheet.GetSubSprite(new Rectangle(142, 2, 32, 35));
            hastighet = 2f;
            movement = FiendeMovement.Follow;
            liv = 750;
            skada = 1;

            Random random = new Random();
            riktning = new Vector2((float)(random.NextDouble() * 2 - 1),
                (float)(random.NextDouble() * 2 - 1));
            riktning = GlobalFunctions.ScaleDirection(riktning);
        }
Exemple #21
0
        public Level5(Game1 game, Sprite spriteSheet, Random random1)
            : base()
        {
            spelObjektLista = new List<SpelObjekt>();

            StoneTower torn1 = new StoneTower(game, spriteSheet);
            torn1.Position = new Vector2(300, 300);
            spelObjektLista.Add(torn1);
            StoneTower torn2 = new StoneTower(game, spriteSheet);
            torn2.Position = new Vector2(700, 300);
            spelObjektLista.Add(torn2);
            StoneTower torn3 = new StoneTower(game, spriteSheet);
            torn3.Position = new Vector2(300, 500);
            spelObjektLista.Add(torn3);
            StoneTower torn4 = new StoneTower(game, spriteSheet);
            torn4.Position = new Vector2(700, 500);
            spelObjektLista.Add(torn4);
        }
Exemple #22
0
        public Level4(Game1 game, Sprite spriteSheet, Random random1)
            : base()
        {
            spelObjektLista = new List<SpelObjekt>();

            for (int n = 0; n < 10; n++)
            {
                FiendeMyra myra = new FiendeMyra(game, spriteSheet);
                myra.Position = new Vector2(random1.Next(870), random1.Next(670));
                myra.SetExternalRandom(random1);
                myra.SetRandomDirection();
                spelObjektLista.Add(myra);
            }

            FiendeMyrEgg egg = new FiendeMyrEgg(game, spriteSheet);
            egg.Position = new Vector2(300, 300);
            spelObjektLista.Add(egg);
        }
Exemple #23
0
        public Level1(Game1 game, Sprite spriteSheet, Random random1)
            : base()
        {
            spelObjektLista = new List<SpelObjekt>();

            //FiendeTorn
            FiendeTorn torn1 = new FiendeTorn(game, spriteSheet);
            torn1.Position = new Vector2(300, 300);
            spelObjektLista.Add(torn1);
            FiendeTorn torn2 = new FiendeTorn(game, spriteSheet);
            torn2.Position = new Vector2(700, 300);
            spelObjektLista.Add(torn2);
            FiendeTorn torn3 = new FiendeTorn(game, spriteSheet);
            torn3.Position = new Vector2(300, 500);
            spelObjektLista.Add(torn3);
            FiendeTorn torn4 = new FiendeTorn(game, spriteSheet);
            torn4.Position = new Vector2(700, 500);
            spelObjektLista.Add(torn4);

            //VanligFiende
            for (int n = 0; n < 10; n++)
            {
                VanligFiende f1 = new VanligFiende(game, spriteSheet);
                f1.Position = new Vector2(random1.Next(870), random1.Next(670));
                spelObjektLista.Add(f1);
            }

            //MinGubbe
            Random random2 = new Random();
            for (int n = 0; n < 5; n++)
            {
                MinFiende f1 = new MinFiende(game, spriteSheet);
                f1.Position = new Vector2(random2.Next(870), random2.Next(670));
                spelObjektLista.Add(f1);
            }
        }
Exemple #24
0
 public Level2Knapp(Game1 game, Sprite spriteSheet, Vector2 position, Level level)
     : base(game, spriteSheet, position, level)
 {
     displaySprite = spriteSheet.GetSubSprite(new Rectangle(80, 80, 50, 30));
 }
Exemple #25
0
 public void AddFrame(Sprite frame)
 {
     frames.Add(frame);
 }
Exemple #26
0
 public ExitKnapp(Game1 game, Sprite spriteSheet, Vector2 position)
     : base(spriteSheet, position)
 {
     this.game = game;
     displaySprite = spriteSheet.GetSubSprite(new Rectangle(0, 90, 80, 40));
 }
Exemple #27
0
        public static bool VisiblePixelsColliding(Rectangle bounds1, Rectangle bounds2,
                           Sprite sprite1, Sprite sprite2,
                           Vector2 origin1, Vector2 origin2)
        {
            Rectangle intersectRect = IntersectRectangle(bounds1, bounds2);

            if (intersectRect == Rectangle.Empty)
                return false;

            int pixelCount = intersectRect.Width * intersectRect.Height;

            Color[] pixels1 = new Color[pixelCount];
            Color[] pixels2 = new Color[pixelCount];

            sprite1.Texture.GetData<Color>(0, Normalize(intersectRect, new Vector2(bounds1.X, bounds1.Y),
                Vector2.Zero, sprite1.SourceRectangle), pixels1, 0, pixelCount);

            sprite2.Texture.GetData<Color>(0, Normalize(intersectRect, new Vector2(bounds2.X, bounds2.Y),
                Vector2.Zero, sprite2.SourceRectangle), pixels2, 0, pixelCount);

            for (int i = 0; i < pixelCount; i++)
            {
                if (pixels1[i].A > ALPHA_THRESHOLD && pixels2[i].A > ALPHA_THRESHOLD)
                    return true;
            }

            return false;
        }
Exemple #28
0
 public HowToPlayKnapp(Game1 game, Sprite spriteSheet, Vector2 position)
     : base(spriteSheet, position)
 {
     displaySprite = spriteSheet.GetSubSprite(new Rectangle(0, 130, 80, 40));
     this.game = game;
 }
Exemple #29
0
 public SpelarSkott(Game1 game, Sprite spriteSheet)
     : base(game, spriteSheet)
 {
 }
Exemple #30
0
 public TestLevelKnapp(Game1 game, Sprite spriteSheet, Vector2 position, Level level)
     : base(game, spriteSheet, position, level)
 {
     displaySprite = spriteSheet.GetSubSprite(new Rectangle(80, 200, 50, 30));
     this.game = game;
 }