Bevy0.6
2048with Bevy ECS
2048 is a 2d board-oriented game. We cover foundational Bevy concepts while spawning tiles on the screen, handling user input, keeping score, and querying for resources in a small contained game. Bevy systems also provide a contained playground for Rust language concepts like references and ownership.
Watch 2 hours, 10 minutes of guided lessons.

Extra Workshop Details
- Notes
This workshop is written against Bevy v0.5. Updates are relatively minor and are catalogued here on GitHub. You can take the workshop with Bevy 0.5 or choose to upgrade to the most recent Bevy and keep the changes as a reference.
As always, if you choose to upgrade and have any trouble doing so, support is available in Discord.
2048
fn game_reset(mut commands: Commands,tiles: Query<Entity, With<Position>>,mut game: ResMut<Game>,) {for entity in tiles.iter() {commands.entity(entity).despawn_recursive();}game.score = 0;}
Lessons
Initializing a new Bevy project
Adding a 2d camera to a Bevy app
Spawning the 2048 board
Using Resources to change the look of the board
Filling out the 2048 board with tile placeholders
Spawning tiles to start the game
Loading a font to render Tile points
Updating Tile display when Point values change
Turning keyboard input into board moves by implementing TryFrom
Sorting Tiles using Ordering and Iterators
Merging Tiles using Peekable Iterators
Updating Tile Position on screen using Transforms
Board shifts in 4 directions
Spawning new Tiles using Bevy's Events
Keeping Score using a custom Game Resource
Writing a plugin to handle game UI using Bevy's built-in UI abstractions
Live updating the score display with a Bevy System
Detecting if there are any moves left and determining when to end the game
Using Rust Enums to implement Playing, Game Over and other states of play
Making Buttons interactive and changing styles
Despawning tiles to start a new game by re-using existing systems
Tracking and displaying the high score
Animating tiles when board shifts happen with bevy_easings