diff options
| author | aldrikboy <aldrikboy@gmail.com> | 2018-01-17 14:26:43 +0100 |
|---|---|---|
| committer | aldrikboy <aldrikboy@gmail.com> | 2018-01-17 14:26:43 +0100 |
| commit | af0ba50d00722e1b7330d1f9b1d23bd3b07a5567 (patch) | |
| tree | fbd7f63dc9bdfc4f1019c03b8f6bf7accb2dce7d /Penguloon/Projectiles | |
| parent | a9daa029db68962603905eded0e29c2a2e2abd91 (diff) | |
upgrades
Diffstat (limited to 'Penguloon/Projectiles')
| -rw-r--r-- | Penguloon/Projectiles/ProjectileBase.cs | 25 | ||||
| -rw-r--r-- | Penguloon/Projectiles/SnowballProjectile.cs | 4 |
2 files changed, 17 insertions, 12 deletions
diff --git a/Penguloon/Projectiles/ProjectileBase.cs b/Penguloon/Projectiles/ProjectileBase.cs index 4a4f1a2..6427c35 100644 --- a/Penguloon/Projectiles/ProjectileBase.cs +++ b/Penguloon/Projectiles/ProjectileBase.cs @@ -61,21 +61,26 @@ namespace Penguloon.Projectiles for(int i = 0; i < ParentObject.Map.Enemies.Count; i++) { - if (ParentObject.Map.Enemies[i].Dead) continue; - - if (projectileRec.Intersects(ParentObject.Map.Enemies[i].Box)) + try { - ParentObject.Map.Enemies[i].GetHit(); - - this.BaloonsPopped++; + if (ParentObject.Map.Enemies[i] != null) + if (ParentObject.Map.Enemies[i].Dead) continue; - // Remove object if it has hit maximum amount of targets - if(BaloonsPopped >= MaxBalloonPops) + if (projectileRec.Intersects(ParentObject.Map.Enemies[i].Box)) { - ParentObject.Projectiles.Remove(this); - return; + ParentObject.Map.Enemies[i].GetHit(); + + this.BaloonsPopped++; + + // Remove object if it has hit maximum amount of targets + if (BaloonsPopped >= MaxBalloonPops) + { + ParentObject.Projectiles.Remove(this); + return; + } } } + catch { } } } } diff --git a/Penguloon/Projectiles/SnowballProjectile.cs b/Penguloon/Projectiles/SnowballProjectile.cs index 9f72794..c841fa9 100644 --- a/Penguloon/Projectiles/SnowballProjectile.cs +++ b/Penguloon/Projectiles/SnowballProjectile.cs @@ -5,13 +5,13 @@ namespace Penguloon.Projectiles { public class SnowballProjectile : ProjectileBase { - public SnowballProjectile(ObjectBase ParentObject, float RotationAngle) : base(ParentObject, RotationAngle) + public SnowballProjectile(ObjectBase ParentObject, float RotationAngle, int extraPops = 0) : base(ParentObject, RotationAngle) { this.Texture = ContentManager.GetTexture("Bullets/penguin-ammo"); this.Speed = 250f; this.RotationSpeed = 5f; this.Size = new Vector2(ParentObject.Map.TileWidth / 2, ParentObject.Map.TileHeight / 2); - this.MaxBalloonPops = 1; + this.MaxBalloonPops = 1 + extraPops; Rectangle parentRec = new Rectangle(ParentObject.Position.ToPoint(), new Point(ParentObject.TileSpanX * ParentObject.Map.TileWidth, ParentObject.TileSpanY * ParentObject.Map.TileHeight)); |
