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

Fix child animation desync with override

parent 6c87a1e4
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. ...@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.3.1]
### Fixed
- Child animations would not play correct animation when parent has an override
## [0.2.1] ## [0.2.1]
### Fixed ### Fixed
......
[package] [package]
name = "micro_banimate" name = "micro_banimate"
version = "0.3.0" version = "0.4.0"
edition = "2021" edition = "2021"
license = "Apache-2.0" license = "Apache-2.0"
description = "Easily manage complex Bevy 2D sprite animations" description = "Easily manage complex Bevy 2D sprite animations"
......
...@@ -354,12 +354,36 @@ impl<'w, 's> AnimationQuery<'w, 's> { ...@@ -354,12 +354,36 @@ impl<'w, 's> AnimationQuery<'w, 's> {
} }
if let Ok(mut sprite) = self.tile_sprite.get_mut(entity) { if let Ok(mut sprite) = self.tile_sprite.get_mut(entity) {
if let Some(current) = self let (directional_name, active_name, frame) =
.animations match self.action_animation.get_mut(**parent) {
.get(handle) Ok(override_status) => match self.direction.get(**parent) {
.and_then(|sheet| sheet.get(&status.active_name)) Ok(dir) => {
{ let directional = format!("{}_{}", override_status.name, dir);
sprite.index = current.frames[status.active_step]; (
directional,
override_status.name.clone(),
override_status.frame_step,
)
}
Err(_) => (
override_status.name.clone(),
override_status.name.clone(),
override_status.frame_step,
),
},
Err(_) => (
status.active_name.clone(),
status.active_name.clone(),
status.active_step,
),
};
if let Some(current) = self.animations.get(handle).and_then(|sheet| {
sheet
.get(&directional_name)
.or_else(|| sheet.get(&active_name))
}) {
sprite.index = current.frames[frame];
} }
} }
} }
......
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