From 0717a9dd4b0d1b69b06d1995e24bba0367a47a4c Mon Sep 17 00:00:00 2001 From: Louis Capitanchik <contact@louiscap.co> Date: Thu, 27 Oct 2022 14:57:23 +0100 Subject: [PATCH] Assert first frame of next anim at end of OnceAndThen animations --- CHANGELOG.md | 10 ++++++++++ Cargo.toml | 2 +- src/query.rs | 8 +++++++- 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..fad2cd9 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,10 @@ +# 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.1.1] + +### Fixed +- "play once and then" animations could overflow frame array bounds \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 0042208..fb2ba21 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "micro_banimate" -version = "0.1.0" +version = "0.1.1" edition = "2021" license = "Apache-2.0" description = "Easily manage complex Bevy 2D sprite animations" diff --git a/src/query.rs b/src/query.rs index a1d949b..5bf2985 100644 --- a/src/query.rs +++ b/src/query.rs @@ -265,7 +265,7 @@ impl<'w, 's> AnimationQuery<'w, 's> { None => continue, }; - let current = match sheet.get(&status.active_name) { + let mut current = match sheet.get(&status.active_name) { Some(set) => set, None => continue, }; @@ -288,6 +288,12 @@ impl<'w, 's> AnimationQuery<'w, 's> { *mode = AnimationMode::Loop; status.active_name = next.clone(); status.frame_time = 0.0; + status.active_step = 0; + + current = match sheet.get(&status.active_name) { + Some(set) => set, + None => continue, + }; } } -- GitLab