1. Home
  2. /
  3. Bevy
  4. /
  5. Spawn Moving Entity Example

Spawn Moving Entity Example - Bevy Typing CST Test

Loading…

Spawn Moving Entity Example — Bevy Code

Spawns an entity and moves it automatically.

use bevy::prelude::*;

struct Mover;

fn main() {
	App::build()
		.add_plugins(DefaultPlugins)
		.add_startup_system(setup.system())
		.add_system(move_entity.system())
		.run();
}

fn setup(mut commands: Commands) {
	commands.spawn().insert(Mover).insert(Transform::default()).insert(GlobalTransform::default());
}

fn move_entity(time: Res<Time>, mut query: Query<&mut Transform, With<Mover>>) {
	for mut transform in query.iter_mut() {
		transform.translation.x += 50.0 * time.delta_seconds();
	}
}

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.

More Bevy Typing Exercises

Bevy Simple Counter ExampleBevy Moving Sprite ExampleBevy FPS Counter ExampleBevy Simple Timer ExampleBevy Mouse Position ExampleBevy Simple Animation ExampleBevy Keyboard Input ExampleBevy Click Detection ExampleBevy Random Movement Example

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher