Пример #1
0
        public Boss(Screens.ScreenManager screenManager, Vector2 position, Map.Room parentRoom, Player player, int level)
            : base(screenManager, position, parentRoom, player)
        {
            collisionOffsetX = 0;
            collisionOffsetY = 0;
            collisionBox.x = (int)position.X + collisionOffsetX;
            collisionBox.y = (int)position.Y + collisionOffsetY;
            collisionBox.width = 32;
            collisionBox.height = 32;
            currentSourceRect = BossBody;

            animCount = 4;
            animSpeed = 0.1f;
            isHurtingOnContact = true;
            health = 6;
            maxHealth = 6;
            maxSpeed = 1.1f;
            //invincibleCountdownSpeed = -0.02f;

            if (screenManager.RNG.Next(100) < 50)
                velocity.X = maxSpeed;
            else
                velocity.X = -maxSpeed;

            this.level = level;

            leftArm = new BossArm(screenManager, position, parentRoom, player, level, true);
            rightArm = new BossArm(screenManager, position, parentRoom, player, level, false);
            parentRoom.addEnemy(leftArm);
            parentRoom.addEnemy(rightArm);
        }
        public override void onCollection(Player player)
        {
            if (fadeOut)
                return;

            Random rand = new Random();
            int randomNumber = rand.Next(100);
            if (randomNumber < 25)
            {
                player.Attack += 1;
                effectString = "Attack power increased!";
            }
            else if (randomNumber < 50)
            {
                player.MaxHealth += 2;
                effectString = "Health increased!";
            }
            else if (randomNumber < 75)
            {
                player.Speed += 0.1f;
                effectString = "Speed increased!";
            }
            else
            {
                player.MaxHealth += 4;
                effectString = "Health increased twice!";
            }

            fadeOut = true;
            screenManager.powerup.Play();
        }
        public HorizontalSpike(Screens.ScreenManager screenManager, Vector2 position, Map.Room parentRoom, Player player)
            : base(screenManager, position, parentRoom, player)
        {
            collisionOffsetX = 0;
            collisionOffsetY = 0;
            collisionBox.x = (int)position.X + collisionOffsetX;
            collisionBox.y = (int)position.Y + collisionOffsetY;
            collisionBox.width = 32;
            collisionBox.height = 32;
            currentSourceRect = sourceRect;
            countTowardsEnemyCount = false;

            animCount = 1;
            animSpeed = 0.1f;
            isHurtingOnContact = true;
            health = 3;
            maxHealth = 3;
            //invincibleCountdownSpeed = -0.02f;

            if (screenManager.RNG.Next(100) < 50)
                velocity.X = maxSpeed;
            else
                velocity.X = -maxSpeed;

            isHittable = false;
        }
Пример #4
0
        public BossArm(Screens.ScreenManager screenManager, Vector2 position, Map.Room parentRoom, Player player, int level, bool left)
            : base(screenManager, position, parentRoom, player)
        {
            collisionOffsetX = 0;
            collisionOffsetY = 0;
            collisionBox.x = (int)position.X + collisionOffsetX;
            collisionBox.y = (int)position.Y + collisionOffsetY;
            collisionBox.width = 32;
            collisionBox.height = 32;
            currentSourceRect = BossArmSource;
            countTowardsEnemyCount = false;
            if (left)
                currentAnim = 0;
            else
                currentAnim = 1;

            animCount = 2;
            animSpeed = 0f;
            isHittable = false;
            isHurtingOnContact = true;
            health = 3;
            maxHealth = 3;
            maxSpeed = 3f;

            this.level = level;
        }
        public BossProjectile(Screens.ScreenManager screenManager, Vector2 position, Map.Room parentRoom, Player player, Texture2D spriteSheet)
            : base(screenManager, position, parentRoom, player)
        {
            collisionOffsetX = 0;
            collisionOffsetY = 0;
            collisionBox.x = (int)position.X + collisionOffsetX;
            collisionBox.y = (int)position.Y + collisionOffsetY;
            collisionBox.width = 7 * 2;
            collisionBox.height = 8 * 2;
            currentSourceRect = BossProjectileRect;

            animCount = 2;
            animSpeed = 0.2f;

            velocity = player.Position - position;
            velocity.Normalize();
            velocity *= 2f;

            currentState = State.Attacking;
            attackRect.width = collisionBox.width;
            attackRect.height = collisionBox.height;

            this.spriteSheet = screenManager.SpriteSheet;
            countTowardsEnemyCount = false;
            health = 2;
        }
 public override void onCollection(Player player)
 {
     if (player.Health < player.MaxHealth)
     {
         player.Health += health;
         parentRoom.removeItem(this);
         screenManager.powerup.Play();
     }
 }
        public EnemyEntity(Screens.ScreenManager screenManager, Vector2 position, Map.Room parentRoom, Player player)
            : base(screenManager)
        {
            this.position = position;
            spriteRect.x = 0;
            spriteRect.y = 0;
            spriteRect.width = 32;
            spriteRect.height = 32;

            this.parentRoom = parentRoom;
            this.player = player;
        }
Пример #8
0
        public Slime(Screens.ScreenManager screenManager, Vector2 position, Map.Room parentRoom, Player player )
            : base(screenManager, position, parentRoom, player)
        {
            collisionOffsetX = 4 * 2;
            collisionOffsetY = 5 * 2;
            collisionBox.x = (int)position.X + collisionOffsetX;
            collisionBox.y = (int)position.Y + collisionOffsetY;
            collisionBox.width = 16;
            collisionBox.height = 12;
            currentSourceRect = SlimeRect;

            animCount = 2;
            animSpeed = 0.02f;
            isHurtingOnContact = true;

            timer = (float)screenManager.RNG.NextDouble();
        }
Пример #9
0
        public Bat(Screens.ScreenManager screenManager, Vector2 position, Map.Room parentRoom, Player player)
            : base(screenManager, position, parentRoom, player)
        {
            collisionOffsetX = 4 * 2;
            collisionOffsetY = 5 * 2;
            collisionBox.x = (int)position.X + collisionOffsetX;
            collisionBox.y = (int)position.Y + collisionOffsetY;
            collisionBox.width = 16;
            collisionBox.height = 12;
            currentSourceRect = BatRect;

            animCount = 2;
            animSpeed = 0.1f;
            isHurtingOnContact = true;
            health = 3;
            maxSpeed = 1.5f;
            invincibleCountdownSpeed = -0.02f;
        }
        public BossArmPiece(Screens.ScreenManager screenManager, Vector2 position, Map.Room parentRoom, Player player)
            : base(screenManager, position, parentRoom, player)
        {
            collisionOffsetX = 0;
            collisionOffsetY = 0;
            collisionBox.x = (int)position.X + collisionOffsetX;
            collisionBox.y = (int)position.Y + collisionOffsetY;
            collisionBox.width = 12;
            collisionBox.height = 12;
            currentSourceRect = BossArmPieceSource;
            countTowardsEnemyCount = false;

            animCount = 1;
            animSpeed = 0.1f;
            isHurtingOnContact = true;
            isHittable = false;
            health = 3;
            maxHealth = 3;
            maxSpeed = 1.1f;
        }
Пример #11
0
 public abstract void onCollection(Player player);