summaryrefslogtreecommitdiff
path: root/Penguloon/Objects
diff options
context:
space:
mode:
authoraldrikboy <aldrikboy@gmail.com>2017-12-22 20:30:25 +0100
committeraldrikboy <aldrikboy@gmail.com>2017-12-22 20:30:25 +0100
commit1276593bfbbfcdbac24b48cf8b574da25945d763 (patch)
tree3d9e8a4153b5b369184b7c7de55461bd1573d30a /Penguloon/Objects
parent12c565cbb7208b44bd7654289bbac2824901f118 (diff)
ZULUL
Diffstat (limited to 'Penguloon/Objects')
-rw-r--r--Penguloon/Objects/CannonObject.cs9
-rw-r--r--Penguloon/Objects/GoldPenguinObject.cs9
-rw-r--r--Penguloon/Objects/ObjectBase.cs45
-rw-r--r--Penguloon/Objects/PenguinObject.cs9
4 files changed, 69 insertions, 3 deletions
diff --git a/Penguloon/Objects/CannonObject.cs b/Penguloon/Objects/CannonObject.cs
index f3cf7ff..916e617 100644
--- a/Penguloon/Objects/CannonObject.cs
+++ b/Penguloon/Objects/CannonObject.cs
@@ -16,6 +16,15 @@ namespace Penguloon.Objects
this.AttackSpeedMS = 2500;
}
+ public CannonObject(Map map) : base(map)
+ {
+ this.Texture = ContentManager.GetTexture("Objects/cannon");
+ this.TileSpanX = 1;
+ this.TileSpanY = 1;
+ this.Range = Map.TileWidth * 3f;
+ this.AttackSpeedMS = 2500;
+ }
+
public override void DrawUnique(float deltaTime)
{
diff --git a/Penguloon/Objects/GoldPenguinObject.cs b/Penguloon/Objects/GoldPenguinObject.cs
index fc5eb62..c406e2c 100644
--- a/Penguloon/Objects/GoldPenguinObject.cs
+++ b/Penguloon/Objects/GoldPenguinObject.cs
@@ -16,6 +16,15 @@ namespace Penguloon.Objects
this.AttackSpeedMS = 500;
}
+ public GoldPenguinObject(Map map) : base(map)
+ {
+ this.Texture = ContentManager.GetTexture("Objects/penguin2");
+ this.TileSpanX = 1;
+ this.TileSpanY = 1;
+ this.Range = Map.TileWidth * 2.5f;
+ this.AttackSpeedMS = 500;
+ }
+
public override void DrawUnique(float deltaTime)
{
diff --git a/Penguloon/Objects/ObjectBase.cs b/Penguloon/Objects/ObjectBase.cs
index c72788e..cde206d 100644
--- a/Penguloon/Objects/ObjectBase.cs
+++ b/Penguloon/Objects/ObjectBase.cs
@@ -36,6 +36,11 @@ namespace Penguloon.Objects
this.Position = position;
}
+ public ObjectBase(Map map)
+ {
+ this.Map = map;
+ }
+
public void Update(float deltaTime)
{
this.Center = new Vector2(Position.X + ((TileSpanX * Map.TileWidth) / 2), Position.Y + ((TileSpanY * Map.TileHeight) / 2));
@@ -47,7 +52,7 @@ namespace Penguloon.Objects
{
Rotation = (float)GetRotation(Map.Enemies[i].Box.Center.ToVector2());
- if ((DateTime.Now - LastAttack).TotalMilliseconds > AttackSpeedMS)
+ if ((DateTime.Now - LastAttack).TotalMilliseconds > (AttackSpeedMS / (int)Map.Level.ParentScene.Speed))
{
LastAttack = DateTime.Now;
SpawnUnique();
@@ -61,6 +66,40 @@ namespace Penguloon.Objects
Projectiles[i].Update(deltaTime);
UpdateUnique(deltaTime);
+ RemoveUselessProjectiles();
+ }
+
+ private void RemoveUselessProjectiles()
+ {
+ for (int i = 0; i < Projectiles.Count; i++)
+ {
+ if (i < Projectiles.Count)
+ {
+ if (Projectiles[i].Position.X < -50)
+ {
+ Projectiles.Remove(Projectiles[i]);
+ return;
+ }
+
+ if (Projectiles[i].Position.X > StaticUIValues.ScreenViewport.X + 50)
+ {
+ Projectiles.Remove(Projectiles[i]);
+ return;
+ }
+
+ if (Projectiles[i].Position.Y < -50)
+ {
+ Projectiles.Remove(Projectiles[i]);
+ return;
+ }
+
+ if (Projectiles[i].Position.Y > StaticUIValues.ScreenViewport.Y + 50)
+ {
+ Projectiles.Remove(Projectiles[i]);
+ return;
+ }
+ }
+ }
}
public abstract void UpdateUnique(float deltaTime);
@@ -91,8 +130,8 @@ namespace Penguloon.Objects
rotation: (float)rot,
origin: new Vector2(Texture.Width / 2, Texture.Height / 2));
- Map.ParentScene.Main.SpriteBatch.Draw(RangeCircle,
- destinationRectangle: new Rectangle((int)rec.X - ((int)Range), (int)rec.Y - ((int)Range), (int)Range * 2, (int)Range * 2));
+ //Map.ParentScene.Main.SpriteBatch.Draw(RangeCircle,
+ // destinationRectangle: new Rectangle((int)rec.X - ((int)Range), (int)rec.Y - ((int)Range), (int)Range * 2, (int)Range * 2));
}
public abstract void DrawUnique(float deltaTime);
diff --git a/Penguloon/Objects/PenguinObject.cs b/Penguloon/Objects/PenguinObject.cs
index adbdc7e..abb3c3a 100644
--- a/Penguloon/Objects/PenguinObject.cs
+++ b/Penguloon/Objects/PenguinObject.cs
@@ -16,6 +16,15 @@ namespace Penguloon.Objects
this.AttackSpeedMS = 1000;
}
+ public PenguinObject(Map map) : base(map)
+ {
+ this.Texture = ContentManager.GetTexture("Objects/penguin1");
+ this.TileSpanX = 1;
+ this.TileSpanY = 1;
+ this.Range = Map.TileWidth * 2;
+ this.AttackSpeedMS = 1000;
+ }
+
public override void DrawUnique(float deltaTime)
{