Skip to content

Commit

Permalink
Remove projectile when it hit something
Browse files Browse the repository at this point in the history
  • Loading branch information
timotei committed Sep 15, 2011
1 parent 32e692d commit 5a6b712
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion egp_story/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,19 @@ public void Update( LevelMap levelMap, GameTime gameTime )
for ( int i = 0; i < tmpArray.Length; ++i ) {
Projectile projectile = tmpArray[i];
projectile.Animation.Update( gameTime );

projectile.Position += projectile.Velocity * 5;

Rectangle projectileBox = projectile.Animation.FrameBoundingBox;
projectileBox.Offset( ( int ) projectile.Position.X, ( int ) projectile.Position.Y );

if ( !levelMap.Mask.Bounds.Contains( ref projectile.Position ) ) {
// remove this
_projectilesShot.Dequeue( );
}
else if ( !levelMap.CheckRectangleBounds( projectileBox ) ) {
//TODO: add hit animation
_projectilesShot.Dequeue( );
}
}
}

Expand Down

0 comments on commit 5a6b712

Please sign in to comment.