Exemple #1
0
        public EnemyGhost(Texture2D tex, Vector2 pos, Player player, PokemonGeodude geodude) : base(tex, pos, geodude)
        {
            tileSize     = new Point(64, 64);
            this.player  = player;
            isActive     = true;
            isHit        = false;
            healthPoints = 200;
            effect       = SpriteEffects.None;
            enemyState   = EnemyState.Patrol;

            moveDir       = new Vector2(50, 50);
            velocity      = new Vector2(1, 1);
            startVelocity = velocity;
            chasingRange  = 250;

            rand = new Random();

            randomizationPeriod = 2;

            hitBox = new Rectangle((int)pos.X, (int)pos.Y, tileSize.X, tileSize.Y);
            srRect = new Rectangle(0, 0, tex.Width / 6, tex.Height);

            frameInterval = 100;
            spritesFrame  = 6;
        }
        public EnemyRanged(Texture2D tex, Vector2 pos, Player player, PokemonGeodude geodude) : base(tex, pos, geodude)
        {
            //bulletList = new List<Bullet>();

            this.tex     = tex;
            this.pos     = pos;
            this.geodude = geodude;
            this.player  = player;

            bulletOffset = new Vector2(0, tex.Height / 2);

            isActive = true;
            tileSize = new Point(64, 64);
            hitBox   = new Rectangle((int)pos.X, (int)pos.Y, tileSize.X, tileSize.Y);
            srRect   = new Rectangle(0, 0, tex.Width / 4, tex.Height);

            spritesFrame  = 4;
            frameInterval = 100;

            shotCount = 1;
            shootCD   = 0;

            //bulletOffset = new Vector2(0, -(tex.Height / 2));

            moveDir = new Vector2(50, 50);

            healthPoints = 100;
            chasingRange = 250;

            enemyState = EnemyState.Patrol;
        }
Exemple #3
0
        public EnemyGreed(Texture2D tex, Vector2 pos, Player player, PokemonGeodude geodude) : base(tex, pos, geodude)
        {
            this.player = player;

            tileSize        = new Point(128, 128);
            greedBulletList = new List <Bullet>();

            isActive = true;
            isHit    = false;

            shotCount = 1;
            shootCD   = 0;

            effect  = SpriteEffects.None;
            moveDir = new Vector2(50, 50);

            enemyState    = EnemyState.Patrol;
            velocity      = new Vector2(1, 0);
            startVelocity = velocity;
            chasingRange  = 2000;

            randomizationPeriod = 4;
            rand         = new Random();
            hitBox       = new Rectangle((int)pos.X, (int)pos.Y, tileSize.X, tileSize.Y);
            srRect       = new Rectangle(0, 0, tex.Width / 5, tex.Height);
            healthPoints = 2000;

            frameInterval = 100;
            spritesFrame  = 5;
            spriteSize    = 128;
        }
Exemple #4
0
 public EnemyType(Texture2D tex, Vector2 pos /*, GameWindow window*/, PokemonGeodude geodude) : base(tex, pos)
 {
     this.geodude = geodude;
 }
        public void LoadMap(string fileName)
        {
            objectList      = new List <GameObject>();
            inventory       = new List <GameObject>();
            inventoryArray  = new Inventory[3, 3];
            backgroundArray = new Background[12, 12];
            powerUpList     = new List <PowerUp>();
            enemyList       = new List <EnemyType>();

            List <string> stringList = ReadFromFile(fileName);

            #region Inventory Slots

            for (int i = 0; i < inventoryArray.GetLength(0); i++)
            {
                for (int j = 0; j < inventoryArray.GetLength(1); j++)
                {
                    inventoryArray[i, j] = new Inventory(AssetManager.inventorySlot, new Vector2(64 * i, 64 * j));
                    objectList.Add(inventoryArray[i, j]);
                }
            }

            #endregion

            #region Background
            int backgroundOffset = -2700;

            for (int i = 0; i < backgroundArray.GetLength(0); i++)
            {
                for (int j = 0; j < backgroundArray.GetLength(1); j++)
                {
                    backgroundArray[i, j] = new Background(AssetManager.backgroundLvl1, new Vector2(backgroundOffset + AssetManager.backgroundLvl1.Width * i, backgroundOffset + AssetManager.backgroundLvl1.Height * j));
                }
            }
            #endregion

            #region DGPlatforms

            if (GamePlayManager.levelNumber == 1 || GamePlayManager.levelNumber == 2)
            {
                platformPos = ParseVectorArray(stringList[2]);
                //This is the first platform
                CreatePlatform(AssetManager.longPlatform, platformPos);

                platformPos = ParseVectorArray(stringList[3]);
                //This is the taller version of the platform
                CreatePlatform(AssetManager.tallPlatform, platformPos);

                platformPos = ParseVectorArray(stringList[4]);
                //This is the smallest platform
                CreatePlatform(AssetManager.smallPlatform, platformPos);
            }

            #endregion

            #region BluePlatforms

            if (GamePlayManager.levelNumber == 3 || GamePlayManager.levelNumber == 4)
            {
                platformPos = ParseVectorArray(stringList[2]);
                CreatePlatform(AssetManager.leftTileBlue, platformPos);

                platformPos = ParseVectorArray(stringList[3]);
                CreatePlatform(AssetManager.blockBlue, platformPos);

                platformPos = ParseVectorArray(stringList[4]);
                CreatePlatform(AssetManager.centerTileBlue, platformPos);

                //platformPos = ParseVectorArray(stringList[5]);
                //CreatePlatform(AssetManager.leftLTileBlue, platformPos);

                //platformPos = ParseVectorArray(stringList[6]);
                //CreatePlatform(AssetManager.rightLTileBlue, platformPos);

                platformPos = ParseVectorArray(stringList[7]);
                CreatePlatform(AssetManager.rightTileBlue, platformPos);

                platformPos = ParseVectorArray(stringList[8]);
                CreatePlatform(AssetManager.tallTileBlue, platformPos);
            }

            #endregion

            #region WhitePlatforms

            if (GamePlayManager.levelNumber == 5 || GamePlayManager.levelNumber == 6)
            {
                platformPos = ParseVectorArray(stringList[2]);
                CreatePlatform(AssetManager.leftTileWhite, platformPos);

                platformPos = ParseVectorArray(stringList[3]);
                CreatePlatform(AssetManager.blockWhite, platformPos);

                platformPos = ParseVectorArray(stringList[4]);
                CreatePlatform(AssetManager.centerTileWhite, platformPos);

                //platformPos = ParseVectorArray(stringList[5]);
                //CreatePlatform(AssetManager.leftLTileWhite, platformPos);

                //platformPos = ParseVectorArray(stringList[6]);
                //CreatePlatform(AssetManager.rightLTileWhite, platformPos);

                platformPos = ParseVectorArray(stringList[7]);
                CreatePlatform(AssetManager.rightTileWhite, platformPos);

                platformPos = ParseVectorArray(stringList[8]);
                CreatePlatform(AssetManager.tallTileWhite, platformPos);
            }

            #endregion

            #region Doors

            doorOpen = true;
            doorPos  = ParsePos(stringList[10]);
            door     = new Door(AssetManager.closedDoor, doorPos, doorOpen);
            objectList.Add(door);

            doorOpen = false;
            doorPos  = ParsePos(stringList[11]);
            door     = new Door(AssetManager.closedDoor, doorPos, doorOpen);
            objectList.Add(door);

            #endregion

            #region Magnet PowerUp

            magnetPos = ParsePos(stringList[25]);

            powerUp = new PowerUp(AssetManager.magnet, magnetPos);
            powerUpList.Add(powerUp);
            objectList.Add(powerUp);

            #endregion

            #region Energy PowerUp

            energyPos = ParsePos(stringList[28]);

            powerUp = new PowerUp(AssetManager.energy, energyPos);
            powerUpList.Add(powerUp);
            objectList.Add(powerUp);

            #endregion

            #region Star PowerUp

            starPos = ParsePos(stringList[26]);

            powerUp = new PowerUp(AssetManager.star2, starPos);
            powerUpList.Add(powerUp);
            objectList.Add(powerUp);

            #endregion

            #region Key

            keyPos = ParsePos(stringList[27]);

            key = new Key(AssetManager.keySprite, keyPos);
            objectList.Add(key);

            #endregion

            #region Pokemonball PowerUp

            pokemonballPos = ParsePos(stringList[24]);

            powerUp = new PowerUp(AssetManager.pokeball, pokemonballPos);
            powerUpList.Add(powerUp);
            objectList.Add(powerUp);

            #endregion

            #region Player's Start Position

            playerPos = ParsePos(stringList[0]);

            player = new Player(AssetManager.idlePlayer, playerPos, Game1.window, powerUpList);
            objectList.Add(player);

            #endregion

            #region Geodude PowerUp

            geodude = new PokemonGeodude(AssetManager.pokemonGeodude, new Vector2(player.Position.X - 100, player.Position.Y), powerUp, player, enemyList);
            objectList.Add(geodude);

            #endregion

            #region EnemyGhost

            enemyGhostPos = ParseVectorArray(stringList[12]);
            CreateEnemyGhost(AssetManager.enemyGhost, enemyGhostPos);

            #endregion

            #region EnemySkeleton

            enemySkeletonPos = ParseVectorArray(stringList[13]);
            CreateEnemySkeleton(AssetManager.enemySkeleton, enemySkeletonPos);

            #endregion

            #region EnemyLust

            enemyPos = ParsePos(stringList[14]);

            enemyLust = new EnemyLust(AssetManager.bossCleopatra, enemyPos /*, Game1.window*/, player, geodude);
            enemyList.Add(enemyLust);
            objectList.Add(enemyLust);

            #endregion

            #region EnemyGreed

            enemyPos = ParsePos(stringList[16]);

            enemyGreed = new EnemyGreed(AssetManager.bossAlighiero, enemyPos, player, geodude);
            enemyList.Add(enemyGreed);
            objectList.Add(enemyGreed);

            #endregion

            #region EnemyRanged

            enemyRangedPos = ParseVectorArray(stringList[15]);
            CreateEnemyRanged(AssetManager.enemyBug, enemyRangedPos);

            #endregion

            #region Item Spawn

            itemPos = ParseVectorArray(stringList[20]);

            for (int i = 0; i < itemPos.Length; i++)
            {
                random = rand.Next(0, 3);
                item   = new Item(random, AssetManager.item, itemPos[i], inventoryArray);

                objectList.Add(item);
            }

            #endregion

            #region Wings PowerUp

            wingsPos = ParsePos(stringList[22]);

            powerUp = new PowerUp(AssetManager.wing, wingsPos);
            powerUpList.Add(powerUp);
            objectList.Add(powerUp);

            #endregion

            #region Boots PowerUp

            bootsPos = ParsePos(stringList[23]);

            powerUp = new PowerUp(AssetManager.boots, bootsPos);
            powerUpList.Add(powerUp);
            objectList.Add(powerUp);

            #endregion

            #region Coin

            coinPos = ParseVectorArray(stringList[13]);

            CreateCoin(AssetManager.coin, coinPos);

            #endregion
        }