public void Draw(SpriteBatch spriteBatch) { if (DrawRectangle.Intersects(Camera.Rectangle)) { spriteBatch.Draw(spritesheet, Camera.RelativeRectangle(DrawRectangle), animation.Frame, Color.White); } }
public bool checkPlayerCollision(Rectangle rect) { if (DrawRectangle.Intersects(rect)) { return(true); } return(false); }
public int checkProjectileCollision(Projectile[] projs) { int damage = 0; for (int i = 0; i < projs.Length; i++) { if (projs[i].IsActive()) { if (DrawRectangle.Intersects(projs[i].DrawRectangle)) { projs[i].DeActivate(); damage = 40; break; } } } return(damage); }
public void enemyHealthUpdate() { Enemy[] enemies = Controller.getEnemies(); if (enemies != null) { for (int i = 0; i < enemies.Length; i++) { if (enemies[i].IsActive() == true) { if (DrawRectangle.Intersects(enemies[i].DrawRectangle)) { if (enemies[i].timeForTermination == false) { Health -= 50; enemies[i].Health = 0; } } } } } }
public bool checkPlayerCollision(Rectangle[] rect) { /*if() * { * if(timeForTermination == false) * player.Health -= 50; * * return true; * } * * return false;*/ bool returnValue = false; foreach (Rectangle r in rect) { if (DrawRectangle.Intersects(r)) { returnValue = true; } } return(returnValue); }