velocity for projectiles
This commit is contained in:
@@ -177,11 +177,23 @@ fn tick_displaying_bubbles(world: &mut World, delta: f32)
|
|||||||
.with(bubble_entity, |t| t.position)
|
.with(bubble_entity, |t| t.position)
|
||||||
.unwrap_or(Vec3::ZERO);
|
.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();
|
let projectile_entity = world.spawn();
|
||||||
world.transforms.insert(
|
world
|
||||||
projectile_entity,
|
.transforms
|
||||||
Transform::from_position(bubble_pos),
|
.insert(projectile_entity, Transform::from_position(bubble_pos));
|
||||||
);
|
|
||||||
world
|
world
|
||||||
.names
|
.names
|
||||||
.insert(projectile_entity, "DialogProjectile".to_string());
|
.insert(projectile_entity, "DialogProjectile".to_string());
|
||||||
@@ -192,6 +204,7 @@ fn tick_displaying_bubbles(world: &mut World, delta: f32)
|
|||||||
bubble_entity,
|
bubble_entity,
|
||||||
correct_parry,
|
correct_parry,
|
||||||
parry_window_open: false,
|
parry_window_open: false,
|
||||||
|
velocity,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user