velocity for projectiles

This commit is contained in:
Jonas H
2026-04-02 19:55:50 +02:00
parent dffd731b87
commit 2846c04765

View File

@@ -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,
},
);