Skip to content

Simple action system for Bevy.

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

undersquire/bevy_action

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bevy_action

Simple action system for Bevy.

Introduction

This plugin exists mainly to facilitate a common action system for other plugins to hook in to (e.g. bevy_action_animation).

It also serves as a way to decouple certain parts of game logic to avoid hard-coding things, such as hard-coding input handling to actions rather than directly to movement logic.

There are three main components, the Action trait, the ActionEvent event, and the ActionPlugin.

Usage

Start by defining your own type to represent the actions (enum is recommended). You will then need to derive the required traits:

#[derive(Clone, Debug, PartialEq, Eq, Hash, Default, Action)]
enum MyAction {
  #[default]
  Idle,
  Left,
  Right,
  Jump
}

Next, register the plugin using this type as the generic parameter:

fn main() {
  App::new()
    ...
    .add_plugin(ActionPlugin::<MyAction>::default())
    ...
}

Now, ActionEvent<MyAction> can be used with EventReader and EventWriter just like any normal Bevy event.

Compatibility

Bevy Version Plugin Version
0.10.x 0.1

About

Simple action system for Bevy.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages