Simple Animation Example - Bevy Typing CST Test
Loading…
Simple Animation Example — Bevy Code
Plays frame-based sprite animation using a timer.
use bevy::prelude::*;
struct AnimationTimer(Timer);
struct SpriteSheet;
fn main() {
App::build()
.add_plugins(DefaultPlugins)
.add_startup_system(setup.system())
.add_system(animate_sprite.system())
.run();
}
fn setup(mut commands: Commands) {
commands.spawn_bundle(OrthographicCameraBundle::new_2d());
commands.spawn().insert(SpriteSheet).insert(AnimationTimer(Timer::from_seconds(0.1, true)));
}
fn animate_sprite(time: Res<Time>, mut query: Query<&mut AnimationTimer>) {
for mut timer in query.iter_mut() {
timer.0.tick(time.delta());
if timer.0.finished() {
println!("Frame advanced");
}
}
}Bevy Language Guide
Bevy is a modern, open-source Rust game engine designed for high-performance 2D and 3D games, with a focus on ECS architecture, modularity, and cross-platform support for desktop and web.
Primary Use Cases
- ▸Cross-platform 2D and 3D games
- ▸Rust-native game projects
- ▸Educational games and simulations
- ▸Prototypes and experimental game engines
- ▸WebAssembly and desktop deployment
Notable Features
- ▸Rust-based ECS (Entity Component System)
- ▸Modular plugin architecture
- ▸wgpu renderer for 2D/3D
- ▸Bevy UI toolkit
- ▸Asset management and hot-reloading
Origin & Creator
Bevy was created by Carter Anderson and maintained by an open-source community, emphasizing Rust-native ECS and performance-focused game development.
Industrial Note
Bevy is gaining traction in Rust-native game development, educational games, indie 2D/3D games, simulations, and hobby projects where performance and safety are priorities.