summaryrefslogtreecommitdiff
path: root/Penguloon/Projectiles
diff options
context:
space:
mode:
Diffstat (limited to 'Penguloon/Projectiles')
-rw-r--r--Penguloon/Projectiles/ProjectileBase.cs25
-rw-r--r--Penguloon/Projectiles/SnowballProjectile.cs4
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));