Example #1
0
        public int CollidesWith(ShooterShip s)
        {
            int score = 0;
            foreach(ShooterGameObject e in _enemies)
            {
                if(e.GetCollisionBox().Intersects(s.GetCollisionBox()) && !s.IsDying())
                {
                    s.Kill();
                    score += e.Damage();
                }

                if(s.GetShot() != null)
                {
                    if (!e.IsDying())
                    {
                        if (e.GetCollisionBox().Intersects((s.GetShotCollisionBox())))
                        {
                            score += e.Damage();
                            s.KillProjectile();
                        }
                    }
                }
            }
            return score;
        }
Example #2
0
        public Shooter(SystemDisplay main, int level)
        {
            _main = main;
            _ship = new ShooterShip(0, _width);

            _levels = new List<ShooterLevel>();

            _herdList = new List<ShooterHerd>();

            //remove later
            SystemMain.Drawing.DestroyTips();
            SystemMain.Drawing.DrawInstruction(40, 560, " to try and kill SQUIDS!", SystemMain.TexturePackage["A"], 3);
            StartGame(level);
        }
Example #3
0
        //projectile list
        public Shooter(SystemDisplay main)
        {
            _main = main;
            _ship = new ShooterShip();
            //_shipRect = new Rectangle(_ship.GetX(), _ship.GetY(), _ship.GetWidth(), _ship.GetHeight());

            #region sample level - delete when xml works

            _enemies = new List<ShooterEnemy>
                       			{
                       				new ShooterEnemy(0, 0, 10, Color.White),
                       				//new ShooterEnemy(1, 0, 10, Color.Gainsboro),
                       				//new ShooterEnemy(4, 0, 10, Color.Goldenrod)
                       			};
            #endregion
        }
Example #4
0
        //projectile list

        public Shooter(SystemDisplay main)
        {
            _main = main;
            _ship = new ShooterShip();
            //_shipRect = new Rectangle(_ship.GetX(), _ship.GetY(), _ship.GetWidth(), _ship.GetHeight());

            #region sample level - delete when xml works

            _enemies = new List <ShooterEnemy>
            {
                new ShooterEnemy(0, 0, 10, Color.White),
                //new ShooterEnemy(1, 0, 10, Color.Gainsboro),
                //new ShooterEnemy(4, 0, 10, Color.Goldenrod)
            };
            #endregion
        }
Example #5
0
 public void CollidesWithProjectiles(ShooterShip s)
 {
     foreach(ShooterProjectile p in _projectiles)
     {
         if(p.GetCollisionBox().Intersects(s.GetCollisionBox()) && !s.IsDying())
         {
             s.Kill();
             _projectiles.RemoveRange(0, _projectiles.Count);
             break;
         }
     }
 }
Example #6
0
 public void ResetGame()
 {
     _ship = new ShooterShip(0, _width);
 }
Example #7
0
        public bool GameLost()
        {
            if(_ship.IsDead())
            {
                _lives--;
                _ship = new ShooterShip(0, _width);
            }

            if(_lives < 0)
            {
                return true;
            }
            return false;
        }