diff options
Diffstat (limited to 'src/content/entities')
| -rw-r--r-- | src/content/entities/entity_bullet_emitter.rs | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/content/entities/entity_bullet_emitter.rs b/src/content/entities/entity_bullet_emitter.rs index cddb4b3..c014e8c 100644 --- a/src/content/entities/entity_bullet_emitter.rs +++ b/src/content/entities/entity_bullet_emitter.rs @@ -25,16 +25,13 @@ impl EntityBehaviour for BulletEmitterEntityBehaviour { } if let Some(target) = self.target { + let pos = update_ctx.entity_data.transform(ctx).unwrap().0; + let dir = (target - pos).normalize(); + self.shot_timer -= delta_time; if self.shot_timer <= 0.0 { - apply_bullet( - ctx, - update_ctx.entity_data.transform(ctx).unwrap().0, - target, - 1000, - ); - // self.shot_timer = 0.1; - update_ctx.deferred_destroy(update_ctx.entity_data.id); + apply_bullet(ctx, pos + (dir * 4.0), target, 70); + self.shot_timer = 0.1; } self.life -= delta_time; |
