Commit 1f573a2c authored by Rahix's avatar Rahix 🦀
Browse files

bottle_angel: Show empty bottle drop points

Instead of deleting drop points on contact, change them to be an empty
drop point instead.
parent 5f075603
......@@ -2,6 +2,7 @@ use crate::colliders;
use crate::components;
use crate::entities;
use crate::resources;
use crate::sprites;
use crate::svg_loader;
pub struct BottleAngelShift {
......@@ -66,8 +67,9 @@ impl BottleAngelState {
#[legion::system]
#[read_component(colliders::Collider)]
#[read_component(components::Matebottledrop)]
#[write_component(components::Sprite)]
pub fn collect_bottledrops(
world: &legion::world::SubWorld,
world: &mut legion::world::SubWorld,
cmd: &mut legion::systems::CommandBuffer,
#[resource] player: &resources::Player,
#[resource] collision_world: &colliders::CollisionWorld,
......@@ -79,7 +81,7 @@ pub fn collect_bottledrops(
.get(world, player.0)
.unwrap();
let mut bottledrops = <&components::Matebottledrop>::query();
let mut bottledrops = <(&components::Matebottledrop, &mut components::Sprite)>::query();
for pair in collision_world
.world
.proximities_with(collider.handle.unwrap(), false)
......@@ -90,8 +92,9 @@ pub fn collect_bottledrops(
}
let entity = *collision_world.world.objects.get(pair.1).unwrap().data();
if bottledrops.get(world, entity).is_ok() {
cmd.remove(entity);
if let Ok((_, sprite)) = bottledrops.get_mut(world, entity) {
*sprite = components::Sprite::new(sprites::Sprite::BottleDropPointEmpty);
cmd.remove_component::<components::Matebottledrop>(entity);
bottle_angel_state.collected_drops += 1;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment