Skip to content

Commit

Permalink
killable npcs
Browse files Browse the repository at this point in the history
Signed-off-by: MGZero <[email protected]>
  • Loading branch information
MGZero committed May 29, 2015
1 parent c999758 commit 2350374
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
7 changes: 5 additions & 2 deletions King of Thieves/Actors/CActor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,11 @@ protected virtual void cleanUp()
{
foreach (KeyValuePair<string, CSprite> kvp in _imageIndex)
{
Graphics.CTextures.textures[kvp.Value.atlasName].Dispose();
Graphics.CTextures.textures.Remove(kvp.Value.atlasName);
if (Graphics.CTextures.textures.ContainsKey(kvp.Value.atlasName))
{
Graphics.CTextures.textures[kvp.Value.atlasName].Dispose();
Graphics.CTextures.textures.Remove(kvp.Value.atlasName);
}
kvp.Value.clean();
}
}
Expand Down
11 changes: 10 additions & 1 deletion King of Thieves/Actors/NPC/Enemies/Rope/CBaseRope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public CBaseRope()
_imageIndex.Add(_FAST_SLITHER_RIGHT, new Graphics.CSprite(_FAST_SLITHER_LEFT,true));

_ropeCount += 1;

_hitBox = new Collision.CHitBox(this, 10, 10, 10, 15);

}

Expand Down Expand Up @@ -97,6 +97,13 @@ public override void destroy(object sender)
base.destroy(sender);
}

public override void collide(object sender, CActor collider)
{
base.collide(sender, collider);
if (collider is Items.Swords.CSword || collider is Projectiles.CArrow || collider is Projectiles.CBomb)
_killMe = true;
}

public override void update(GameTime gameTime)
{
base.update(gameTime);
Expand Down Expand Up @@ -194,6 +201,8 @@ protected override void _addCollidables()
base._addCollidables();
_collidables.Add(typeof(Items.Swords.CSword));
_collidables.Add(typeof(Projectiles.CArrow));
_collidables.Add(typeof(Projectiles.CBomb));
_collidables.Add(typeof(Projectiles.CBoomerang));
}
}
}

0 comments on commit 2350374

Please sign in to comment.