17cupsofcoffee / tetra

🎮 A simple 2D game framework written in Rust
MIT License
907 stars 63 forks source link

Add `Animation::is_finished` #315

Closed vrmiguel closed 1 year ago

vrmiguel commented 2 years ago

Hey there :wave: Congrats on this project :smiley:

This PR proposes Animation::is_finished and Animation::has_frames_remaining.

Motivation

This allows us to quickly get rid of "one-off" animations, such as an explosion, damage indicator or whatnot

let is_not_finished = |anim| anim.is_finished().not();

animations.retain(is_not_finished);
17cupsofcoffee commented 1 year ago

Sorry for the massive delay in replying to this, I've been a bit burned out on open source for a while! Finally trying to work through the backlog...

This looks like a sensible feature to add, and low maintainence burden, so I'm fine with merging this :+1:

17cupsofcoffee commented 1 year ago

Thank you!