Skip to content

Commit 5b05cca

Browse files
authored
update README.md
1 parent 714969a commit 5b05cca

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ Raw input handling leads to:
2929
## How to use
3030

3131
```rust
32+
use bevy::{prelude::*, input::InputSystem};
33+
use bevy_actify::*;
34+
3235
// 1. Define your action
3336
#[derive(InputAction, Clone, PartialEq)]
3437
struct Jump(f32); // f32 for analog sensetivity
@@ -47,6 +50,16 @@ fn character_jump(action: InputActionState<Jump>) {
4750
// Apply force...
4851
}
4952
}
53+
54+
// 4. Register the plugin and systems
55+
fn main() {
56+
App::new()
57+
.add_plugins(DefaultPlugins)
58+
.add_plugins(InputActionPlugin::<Jump>::new())
59+
.add_systems(PreUpdate, keyboard_input.after(InputSystem).before(InputActionSystem)) // properly order you systems to avoid 1 frame delay!
60+
.add_systems(Update, character_jump)
61+
.run();
62+
}
5063
```
5164

5265
## How to contribute

0 commit comments

Comments
 (0)