17cupsofcoffee / tetra

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

Add `Animation::is_finished` #314

Closed vrmiguel closed 2 years ago

vrmiguel commented 2 years ago

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

This PR proposes Animation::is_finished.

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);