public override void OnUpdate() { Vector2f lastPosition = position; base.OnUpdate(); position += new Vector2f( speed * world.delta * Mathf.Cos(rotation * Mathf.DEG2RAD), speed * world.delta * Mathf.Sin(rotation * Mathf.DEG2RAD) ); entity.sprite.position = position * Game.TS; LDWorld ldworld = (LDWorld)world; if (ldworld.map.mapCollider.Collides(position)) { entity.DestroyLater(); PlayHitSound(); } IEnumerable <Entity> enemies = world.GetTaggedEntities("Enemy"); foreach (Entity e in enemies) { Daemon daemon = e.GetComponent <Daemon>(); if (e.body.Collides(position)) { if (ldworld.dimension == 1) { //world.debugLines.DrawLine(position, lastPosition); daemon.Hurt(1); entity.DestroyLater(); PlayHitSound(); } else if (!_traversedOnce) { PlayTraverseSound(); _traversedOnce = true; } } } lifeTime += world.delta; if (lifeTime > 2f) { entity.DestroyLater(); } }