diff --git a/src/systems/dialog_system.rs b/src/systems/dialog_system.rs index b75dc5e..34c34d5 100644 --- a/src/systems/dialog_system.rs +++ b/src/systems/dialog_system.rs @@ -177,11 +177,23 @@ fn tick_displaying_bubbles(world: &mut World, delta: f32) .with(bubble_entity, |t| t.position) .unwrap_or(Vec3::ZERO); + let player_entity = world + .player_tags + .all() + .into_iter() + .next() + .expect("no player entity"); + let player_pos = world + .transforms + .with(player_entity, |t| t.position) + .unwrap_or(Vec3::ZERO); + + let velocity = player_pos - bubble_pos; + let projectile_entity = world.spawn(); - world.transforms.insert( - projectile_entity, - Transform::from_position(bubble_pos), - ); + world + .transforms + .insert(projectile_entity, Transform::from_position(bubble_pos)); world .names .insert(projectile_entity, "DialogProjectile".to_string()); @@ -192,6 +204,7 @@ fn tick_displaying_bubbles(world: &mut World, delta: f32) bubble_entity, correct_parry, parry_window_open: false, + velocity, }, );