Skip to content
Snippets Groups Projects
Verified Commit 6c87a1e4 authored by Louis's avatar Louis :fire:
Browse files

Handle directional overrides correctly

parent db0f9c79
No related branches found
No related tags found
No related merge requests found
[package]
name = "micro_banimate"
version = "0.2.1"
version = "0.3.0"
edition = "2021"
license = "Apache-2.0"
description = "Easily manage complex Bevy 2D sprite animations"
......
......@@ -265,10 +265,22 @@ impl<'w, 's> AnimationQuery<'w, 's> {
};
if let Ok(mut status) = self.action_animation.get_mut(entity) {
let current = match sheet.get(&status.name) {
let (a, b) = match self.direction.get(entity) {
Ok(dir) => {
let directional = format!("{}_{}", status.name, dir);
(directional, status.name.clone())
}
Err(_) => (status.name.clone(), status.name.clone()),
};
let current = match sheet.get(&a).or_else(|| sheet.get(&b)) {
Some(set) => set,
None => {
self.commands.entity(entity).remove::<AnimationOverride>();
self.events.send(AnimationCompleted {
entity,
user_data: status.user_data,
});
continue;
}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment