Mode:
Duration:
1
Coding works best on desktop or with an external keyboard.
Coding works best on desktop or with an external keyboard.
Moves an entity randomly each frame.
use bevy::prelude::*;
use rand::prelude::*;
struct Walker;
fn main() {
App::build()
.add_plugins(DefaultPlugins)
.add_startup_system(setup.system())
.add_system(random_move.system())
.run();
}
fn setup(mut commands: Commands) {
commands.spawn().insert(Walker).insert(Transform::default()).insert(GlobalTransform::default());
}
fn random_move(mut query: Query<&mut Transform, With<Walker>>) {
let mut rng = thread_rng();
for mut transform in query.iter_mut() {
transform.translation.x += rng.gen_range(-1.0..1.0);
transform.translation.y += rng.gen_range(-1.0..1.0);
}
}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.
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.