From af0ba50d00722e1b7330d1f9b1d23bd3b07a5567 Mon Sep 17 00:00:00 2001 From: aldrikboy Date: Wed, 17 Jan 2018 14:26:43 +0100 Subject: upgrades --- Penguloon/Projectiles/ProjectileBase.cs | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'Penguloon/Projectiles/ProjectileBase.cs') 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 { } } } } -- cgit v1.2.3-70-g09d2