virtual public void Update(Player player, Tile[][] tiles) { Collisions.CollideWithTiles(tiles, this); location = newLocation; hitBox = new Rectangle((int)location.X, (int)location.Y, width, height); if (state == "hurt") { hurtCounter--; if (hurtCounter <= 0) { hurtCounter = 0; state = "normal"; } } else if (player.swordIsActive && Collisions.EntityCollisions(player.swordHitBox, hitBox)) { GetHit(player, player.swingFacing); player.swordIsActive = false; } else { foreach (Projectile projectile in player.Projectiles) { if (Collisions.EntityCollisions(projectile.hitBox, hitBox)) { string direction = "left"; if (projectile.horizontalVelocity > 0) { direction = "right"; } GetHit(player, direction); player.RemoveProjectile(projectile); break; } } } if (!player.invulnerable && Collisions.EntityCollisions(player.hitBox, hitBox)) { player.GetHit("left", GetDamage()); } }