Skip to content

Commit 0e31e2b

Browse files
authored
N40: Bevy Sequential Actions (#1208)
1 parent 57edf1f commit 0e31e2b

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

content/news/040/index.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,58 @@ _Discussions:
190190
[/r/bevy](https://reddit.com/r/bevy/comments/za93oo/bevy_atmosphere_05_is_now_released),
191191
[/r/rust](https://reddit.com/r/rust/comments/za93zb/bevy_atmosphere_05_is_now_released)_
192192

193+
### [Bevy Sequential Actions]
194+
195+
![Bevy sequential actions simple demo](sequential_actions.gif)
196+
_An entity with a queue of repeating actions._
197+
198+
`bevy-sequential-actions` ([GitHub][seq-actions-gh], [docs.rs][seq-actions-docs])
199+
is a simple helper library for the [Bevy][bevy] game engine.
200+
It aims to execute a queue of various actions in a sequential manner.
201+
202+
An action is anything that implements the `Action` trait,
203+
and can be added to any `Entity` that contains the `ActionsBundle`.
204+
In the image above, the following actions have been added:
205+
206+
```rust
207+
commands
208+
.actions(entity)
209+
.config(AddConfig {
210+
order: AddOrder::Back,
211+
start: true,
212+
repeat: Repeat::Forever,
213+
})
214+
.add(WaitAction::new(1.0))
215+
.add(MoveAction::new(Vec3::X * 2.0))
216+
.add(WaitAction::new(1.0))
217+
.add(MoveAction::new(Vec3::X * -2.0));
218+
```
219+
220+
With version `0.6` comes the ability to
221+
add a collection of actions that run in parallel.
222+
This means that all actions will start and stop at the same time,
223+
as the whole collection is treated as "one action".
224+
In other words, the action queue will only advance
225+
when all actions in the collection are finished.
226+
227+
```rust
228+
commands
229+
.actions(agent)
230+
.add_many(
231+
ExecutionMode::Parallel,
232+
actions![
233+
action_a,
234+
action_b,
235+
action_c,
236+
]
237+
);
238+
```
239+
240+
[Bevy Sequential Actions]: https://crates.io/crates/bevy-sequential-actions
241+
[seq-actions-gh]: https://github.com/hikikones/bevy-sequential-actions
242+
[seq-actions-docs]: https://docs.rs/bevy-sequential-actions
243+
[bevy]: https://bevyengine.org
244+
193245
## Popular Workgroup Issues in Github
194246

195247
<!-- Up to 10 links to interesting issues -->
487 KB
Loading

0 commit comments

Comments
 (0)