Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maplant/bevy-tick-timers
https://github.com/maplant/bevy-tick-timers
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/maplant/bevy-tick-timers
- Owner: maplant
- Created: 2021-01-14T19:33:36.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-05-02T23:57:38.000Z (over 2 years ago)
- Last Synced: 2024-10-18T11:22:15.632Z (3 months ago)
- Language: Rust
- Size: 18.6 KB
- Stars: 11
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Bevy-tick-timers
Provides a [Bevy](https://bevyengine.org/) plugin for scheduling and managing tick based timers.
Tick based timers are timers that operate not on real time, but on the number of state updates
that occur. Each state update constitutes a "tick".For any timer that does not update outside a game session, a tick based timer is preferred. This makes
games more consistent and replayable (which also means they are easier to debug).# Example:
```rust
use bevy::prelude::*;
use bevy_tick_timers::{TimerPlugin, Timers};fn add_timer(
mut timers: ResMut,
) {
// Timers are Bevy systems, and thus can be closures.
timers.after(5, (move || {
println!("timer has gone off!");
}).system());
}fn main() {
println!("starting up");
App::build()
.add_plugins(DefaultPlugins)
.add_plugin(TimerPlugin)
.add_startup_system(add_timer.system())
.run();
}
```