Exemplo n.º 1
0
        //30sec ttl
        /// <summary>
        /// Super constructor for enemies. You must call it in subclasses
        /// </summary>
        /// <param name="_location">Screen location</param>
        /// <param name="_pattern">Move pattern to use</param>
        /// <param name="_scrollValue">Scroll value trigger</param>
        /// <param name="flags">Flags to set on death</param>
        /// <param name="flip">Type of flip</param>
        /// <param name="scale">Sprite scaling (use Vector2.One if not necessary)</param>
        /// <param name="speed">Speed of the enemy</param>
        /// <param name="spriteSrc">Spritesheet rectangle selection</param>
        /// <param name="_bonusDroppedOnDeath">Bonus the enemy will drop on death</param>
        /// <param name="weapon">Enemy weapon</param>
        protected BadGuy(Vector2 _location, Vector2 _scrollValue, Bonus _bonusDroppedOnDeath, MovePattern _pattern, String[] flags, SpriteEffects flip, Rectangle spriteSrc, Vector2 speed, Vector2 scale, Weapon weapon)
            : base(_location, spriteSrc, speed, scale, 0.0f, 30000f)
        {
            this.dropOnDeath = _bonusDroppedOnDeath;
            this.movePattern = _pattern;
            this.scrollValue = _scrollValue;
            this.Flags = flags;

            if (_pattern != null)
            {
                bounce = false;
            }
            else
            {
                bounce = true;
            }

            this.onScreen = false;
            this.rotation = 0.0f;

            this.Flip = flip;
            this.Weapon = weapon;

            if (this.Weapon != null)
            {
                this.Weapon.Flip = flip;
            }

            this.Hitbox = new SquareHitbox(this);
            this.Removable = true;
            this.InfiniteMovePattern = false;
            this.Difficulty = 0;
            this.ttl = 120000;
            this.FiringLocation = Vectors.ConvertPointToVector2(DstRect.Center);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Create a new Shot. Must be used in subclasses. Do some initialisations
        /// </summary>
        ///<param name="loc">Screen location</param>
        ///<param name="srcSprite">Sprite sheet location and size</param>
        ///<param name="speed">Shot speed</param>
        ///<param name="scale">Sprite scaling</param>
        ///<param name="flip">Sprite flip</param>
        ///<param name="_wpn">Firing weapon</param>
        ///<param name="angle">Firing angle</param>
        ///<param name="_enemy">Shot by enemy or by player</param>
        protected Shot(Vector2 loc, Rectangle srcSprite, Vector2 speed, Vector2 scale, SpriteEffects flip, Weapon _wpn, double angle, bool _enemy)
            : base(loc, srcSprite, speed, new Vector2(0.25f, 0.25f), angle, 10000f)
        {
            this.flips = flip;
            this.wpn = _wpn;
            this.rotation = angle;
            this.enemy = _enemy;
            this.sRect = srcSprite;
            this.hitbox = new CircleHitbox(this, true, 2f);
            this.additive = false;
            this.bounce = false;
            this.hp = -1;
            this.points = 0;
            this.CanGoOffLimits = false;
            this.IsHit = false;

            if (this.EnemyFire)
            {
                this.behindColor = defaultEnemyBehindColor;

                if (TGPAContext.Instance.Cheatcodes.IsGiantMode)
                {
                    this.Scale = new Vector2(0.75f, 0.75f);
                }
            }
            else
            {
                this.behindColor = defaultPlayerBehindColor;

                if (TGPAContext.Instance.Cheatcodes.IsGiantMode)
                {
                    this.Scale = new Vector2(0.1f, 0.1f);
                }
            }

            this.DrawBehindEnemies = true;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Create a weapon bonus
        /// </summary>
        /// <param name="_type">Weapon name the bonus contain</param>
        public Bonus(String bonusName)
            : base(Vector2.Zero, Rectangle.Empty, new Vector2(200, 200), new Vector2(0.25f, 0.25f), 0.0f, 15000.0f)
        {
            this.location = Vector2.Zero;

            //Bonus for weapon
            if (bonusName.Equals(typeof(MachineGun).Name))
            {
                sRect = new Rectangle(688, 688, 330, 330);
                this.bonusWpn = new MachineGun();
                this.type = BonusTypes.Weapon;

            }
            else if (bonusName.Equals(typeof(ShotGun).Name))
            {
                sRect = new Rectangle(688, 0, 330, 330);
                this.bonusWpn = new ShotGun();
                this.type = BonusTypes.Weapon;
            }
            else if (bonusName.Equals(typeof(Flamethrower).Name))
            {
                sRect = new Rectangle(335, 692, 330, 330);
                this.bonusWpn = new Flamethrower();
                this.type = BonusTypes.Weapon;
            }
            else if (bonusName.Equals(typeof(RocketLauncher).Name))
            {
                sRect = new Rectangle(5, 682, 330, 330);
                 this.bonusWpn = new RocketLauncher();
                 this.type = BonusTypes.Weapon;
            }
            else if (bonusName.Equals(typeof(LanceTruc).Name))
            {
                sRect = new Rectangle(670, 331, 330, 330);
                this.bonusWpn = new LanceTruc();
                this.type = BonusTypes.Weapon;
            }
            else if (bonusName.Equals(typeof(Megabomb).Name))
            {
                sRect = new Rectangle(0, 340, 330, 330);
                this.bonusWpn = new Megabomb();
                this.type = BonusTypes.Weapon;
            }
            else if (bonusName.Equals(BonusTypes.Life.ToString()))
            {
                sRect = new Rectangle(328, 354, 330, 330);
                this.bonusWpn = null;
                this.type = BonusTypes.Life;
            }
            else if (bonusName.Equals(BonusTypes.Coffee.ToString()))
            {
                sRect = new Rectangle(0, 0, 330, 330);
                this.bonusWpn = null;
                this.type = BonusTypes.Coffee;
            }
            else if (bonusName.Equals(BonusTypes.Cassoulet.ToString()))
            {
                sRect = new Rectangle(332, 0, 330, 330);
                this.bonusWpn = null;
                this.type = BonusTypes.Cassoulet;
            }
            else
            {
                throw new Exception("Unknow bonus : "+bonusName);
            }

            dRect = ComputeDstRect(sRect);
            alpha = 1.0f;
            this.hitbox = new TGPA.Game.Hitbox.CircleHitbox(this, false, 0.75f);
        }
Exemplo n.º 4
0
        public override void TodoOnDeath()
        {
            Lives--;
            Weapon.UpgradeLevel = 0;
            Invincible = 4.0f;
            DeathTime = 1.5f;

            TGPAContext.Instance.ParticleManager.MakeCircularExplosion(Location, 600f, 100);

            Score += 1;

            Hitbox mine = this.hitbox;
            base.TodoOnDeath();

            if (this.Lives >= 0)
            {
                this.hitbox = mine;
            }
            else
            {
                this.wpn = null;
                this.bomb.Ammo = 0;
            }
        }
Exemplo n.º 5
0
 public void Initialize()
 {
     wpn = new MachineGun();
     bomb = new Megabomb();
     this.speed = new Vector2(400.0f, 400.0f); //In case of a flip before
     frame = 0;
     Score = 0;
     Lives = 0;
     invincibleTime = 3.0f;
     DeathTime = 0.0f;
     trajectory = new Vector2();
     Hitbox = new CircleHitbox(this, false, 3.5f);
     this.Flip = SpriteEffects.None;
     enableCommands = true;
 }
        /// <summary>
        /// Kill every context.Enemies in the radius
        /// </summary>
        /// <param name="center"></param>
        /// <param name="radius"></param>
        public void KillEnemiesInArea(Weapon weapon, Vector2 center, int radius)
        {
            foreach (BadGuy bg in Enemies)
            {
                if (!bg.IsOnScreen) continue;

                if (Math.Abs(bg.Location.X - center.X) < radius)
                {
                    if (Math.Abs(bg.Location.Y - center.Y) < radius)
                    {
                        bg.HP -= (int)((float)weapon.Damage * DamageMulti);
                    }
                }
            }
        }
Exemplo n.º 7
0
        public StarFishShot(Vector2 loc, Weapon wpn, double angle, SpriteEffects _flip)
            : base(loc,
            new Rectangle(1024, 0, 256, 256),    //Sprite
            new Vector2(550, 550),          //Speed
            Vector2.One,                    //Scale
            _flip, wpn, angle, true)
        {
            //this.UseRotationWhenDrawing = true;
            this.UseSpriteOrigin();
            this.hitbox = new CircleHitbox(this, true, 2.5f);

            this.Destructable = true;
            this.Points = 300;
            this.Hp = 10;
        }
Exemplo n.º 8
0
 public FishGunShot(Vector2 loc, Weapon wpn, double angle, SpriteEffects _flip)
     : base(loc,
     new Rectangle(460, 110, 178, 76),    //Sprite
     new Vector2(300, 300),          //Speed
     Vector2.One,                    //Scale
     _flip, wpn, angle, true)
 {
     //this.UseRotationWhenDrawing = true;
     this.visualRotation = 0f;
     this.UseSpriteOrigin();
     this.hitbox = new CircleHitbox(this, true, 2f);
 }