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; }
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); }
//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 }
//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 }
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; } } }
public void ResetGame() { _ship = new ShooterShip(0, _width); }
public bool GameLost() { if(_ship.IsDead()) { _lives--; _ship = new ShooterShip(0, _width); } if(_lives < 0) { return true; } return false; }