#bevy #async #user-input #gamedev #game-state #game

bevy_flurx

Provides the ability to wait for game status asynchronously

10 releases

new 0.3.4 Apr 27, 2024
0.3.4-beta.1 Apr 21, 2024
0.3.0 Mar 14, 2024

#256 in Game dev

Download history 123/week @ 2024-03-14 5/week @ 2024-03-21 150/week @ 2024-03-28 309/week @ 2024-04-04 231/week @ 2024-04-11 146/week @ 2024-04-18

836 downloads per month

MIT/Apache

600KB
4.5K SLoC

bevy_flurx

Crates.io MIT/Apache 2.0 Crates.io

This library provides a mechanism for more sequential description of delays, character movement, waiting for user input, and other state waits.

As an example, here is an example of a cut-in effect that involves waiting for user input, a slight delay, and a sprite to move.

cut_in

The full source code can be found here.

fn spawn_reactor(
    mut commands: Commands
) {
    commands.spawn(Reactor::schedule(|task| async move {
        task.will(Update, {
            wait::input::just_pressed().with(KeyCode::KeyR)
                .then(once::switch::on::<CutInBackground>())
                .then(delay::time().with(Duration::from_millis(100)))
                .then(once::switch::on::<HandsomeFerris>())
                .then(wait::both(
                    wait::switch::off::<CutInBackground>(),
                    wait::switch::off::<HandsomeFerris>(),
                ))
                .then(once::switch::on::<MoveSlowly>())
                .then(delay::time().with(Duration::from_millis(500)))
                .then(once::switch::off::<MoveSlowly>())
                .then(once::switch::on::<MoveFast>())
                .then(delay::time().with(Duration::from_millis(300)))
                .then(once::event::app_exit())
        })
            .await;
    }));
}

Highlights of the latest version

As a highlight feature, we have added a record that allows for easy undo and redo.

examples/undo_redo.gif

Example

All examples are here.

ChangeLog

Please see here.

Compatible Bevy versions

bevy_flurx bevy
0.3.0 0.13.0
0.3.1 0.13.1
0.3.2 ~ 0.3.4 0.13.2

License

This crate is licensed under the MIT License or the Apache License 2.0.

Dependencies

~16–58MB
~1M SLoC