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

Fix missing system for directional override animations

parent 167be828
Branches trunk
No related tags found
No related merge requests found
# Changelog
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/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.9.2]
### Fixed
- Directional override animations were being skipped by the override animation filters
- Relational sync was being scheduled in the same set as animation ticks, potentially causing 1-frame desync based on
Bevy scheduling
## [0.9.0]
### Changed
- Required Bevy version is now 0.14
## [0.8.0]
### Changed
- Required Bevy version is not 0.13
- Required Bevy version is now 0.13
## [0.7.0]
......@@ -23,10 +38,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Removed
- `AnimationQuery` has been removed; instead, the ergonomics of controlling animations by manipulating components
directly is much more ergonomic
- `AnimationQuery` has been removed; instead, the ergonomics of controlling animations by manipulating components
directly is much more ergonomic
- Support for `bevy_ecs_tilemap` has been dropped
-
-
## [0.6.0]
......@@ -45,19 +60,23 @@ directly is much more ergonomic
## [0.3.1]
### Fixed
- Child animations would not play correct animation when parent has an override
## [0.2.1]
### Fixed
- Action animation frames overflow
## [0.2.0]
### Added
- Constructor functions for `AnimationOverride`
### Changed
- `bevy` version `0.9`
- `bevy_ecs_tilemap` version `0.9`
- `AnimationOverride` now contains its own state
......@@ -69,4 +88,5 @@ directly is much more ergonomic
## [0.1.1]
### Fixed
- "play once and then" animations could overflow frame array bounds
\ No newline at end of file
[package]
name = "micro_banimate"
version = "0.9.1"
version = "0.9.2"
edition = "2021"
license = "Apache-2.0"
description = "Easily manage complex Bevy 2D sprite animations"
authors = [
"Louis Capitanchik <louis@microhacks.co.uk>"
"Louis Capitanchik <louis@microhacks.co.uk>"
]
repository = "https://lab.lcr.gr/microhacks/micro-banimate"
......
......@@ -37,6 +37,16 @@ pub struct OverrideAnimationComponents {
atlas: &'static mut TextureAtlas,
}
#[derive(QueryData)]
#[query_data(mutable)]
pub struct DirectionalOverrideAnimationComponents {
handle: &'static Handle<AnimationSet>,
direction: &'static Directionality,
data: Option<&'static OverrideData>,
status: &'static mut AnimationOverride,
atlas: &'static mut TextureAtlas,
}
#[derive(QueryData)]
#[query_data(mutable)]
pub struct SimpleAnimationComponents {
......@@ -193,6 +203,51 @@ pub fn play_override_animation(
}
}
pub fn play_directional_override_animation(
time: Res<Time>,
mut commands: Commands,
mut anim_query: Query<
(Entity, DirectionalOverrideAnimationComponents),
OnlyDirectionalOverrideAnimations,
>,
animations: Res<Assets<AnimationSet>>,
mut events: EventWriter<AnimationCompleted>,
) {
let delta = time.delta();
for (
entity,
DirectionalOverrideAnimationComponentsItem {
mut status,
direction,
handle,
mut atlas,
data,
},
) in &mut anim_query
{
let anim = get_current_anim!(
animations,
handle,
format!("{}_{}", status.active_name, direction),
status.active_name
);
let looped = tick_animation!(delta, anim, status, atlas);
if looped {
commands
.entity(entity)
.remove::<(AnimationOverride, OverrideData)>();
if let Some(data) = data {
events.send(AnimationCompleted {
entity,
user_data: **data,
});
}
}
}
}
pub fn play_simple_animation(
time: Res<Time>,
mut anim_query: Query<SimpleAnimationComponents, Without<AnimationPaused>>,
......
use crate::query::{
play_animations, play_directional_animations, play_override_animation, play_simple_animation,
sync_child_animation,
play_animations, play_directional_animations, play_directional_override_animation,
play_override_animation, play_simple_animation, sync_child_animation,
};
use bevy::prelude::*;
......@@ -34,9 +34,10 @@ impl Plugin for AnimationSystemsPlugin {
play_animations,
play_override_animation,
play_directional_animations,
play_directional_override_animation,
play_simple_animation,
)
.in_set(AnimationSystems::SyncAnimations),
.in_set(AnimationSystems::TickAnimations),
)
.add_systems(
PostUpdate,
......
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