Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We’ll start off by using cargo to scaffold a new project. ```rust cargo new snake cd snake ``` A `cargo run` now will give us the usual `"Hello World"` output we get from a new project. We’ll add `bevy` as a dependency. ```rust cargo add bevy ``` and replace the code in `src/main.rs` with some project scaffolding. ```rust use bevy::prelude::*; fn main() { App::new() .insert_resource(WindowDescriptor { title: "Snake!".to_string(), ..Default::default() }) .add_plugins(DefaultPlugins) .insert_resource(ClearColor(Color::rgb( 0.52, 0.73, 0.17, ))) .add_startup_system(setup) .run(); } fn setup(mut commands: Commands) { commands .spawn_bundle(OrthographicCameraBundle::new_2d()); } ``` The scaffolding sets the name of the window that Bevy creates to `Snake!` and adds the default group of plugins from the bevy prelude. We also set the default background to a green color and add a new system that will run once when our game starts up. The `setup` system spawns in a new 2d camera, which we’ll need to be able to render any of the 2d sprites we want to use for the board or the snake or even the food. Also take a moment to download the assets we’ll be using [from GitHub](TODO) and put them in the `assets` directory at the root of the project. We’ll use these for fonts, sprites, and sounds later in the project. If we `cargo run` now, we’ll see a window.
- Loading branch information