fixed flickering on projectile spawn. send origin

This commit is contained in:
2022-08-16 21:03:03 +02:00
parent 614092a8eb
commit 05ca78229f
3 changed files with 19 additions and 14 deletions

View File

@@ -243,17 +243,22 @@ fn client_sync_players(
network_mapping.0.remove(&server_entity);
}
}
ServerMessages::SpawnProjectile { entity } => {
let projectile_entity = commands.spawn_bundle(SpriteBundle {
sprite: Sprite {
color: Color::rgb(0.25, 0.25, 0.75),
custom_size: Some(Vec2::new(5., 5.0)),
ServerMessages::SpawnProjectile { entity, origin } => {
let projectile_entity = commands
.spawn_bundle(SpriteBundle {
sprite: Sprite {
color: Color::rgb(0.25, 0.25, 0.75),
custom_size: Some(Vec2::new(5., 5.0)),
..default()
},
..default()
},
..default()
});
})
.insert_bundle(TransformBundle::from(Transform::from_xyz(
origin.x, origin.y, 0.,
)))
.id();
network_mapping.0.insert(entity, projectile_entity.id());
network_mapping.0.insert(entity, projectile_entity);
}
ServerMessages::DespawnProjectile { entity } => {
if let Some(entity) = network_mapping.0.remove(&entity) {