spawn snake head

This commit is contained in:
Christian Nieves
2024-12-08 01:25:03 -06:00
parent 9190d9eda3
commit dd882752de
3 changed files with 816 additions and 2 deletions

788
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -15,6 +15,8 @@ edition = "2021"
[dependencies]
bevy = { version = "0.15.0", features = ["dynamic_linking"] }
bevy-inspector-egui = "0.28.0"
rand = "0.8.5"
# Enable a small amount of optimization in the dev profile.
[profile.dev]

View File

@ -1,3 +1,27 @@
fn main() {
App::new().add_plugins(DefaultPlugins).run();
use bevy::prelude::*;
use bevy_inspector_egui::quick::WorldInspectorPlugin;
#[derive(Component)]
struct SnakeHead;
const SNAKE_HEAD_COLOR: Color = Color::srgb(0.7, 0.7, 0.7);
fn setup_player(mut commands: Commands) {
commands.spawn(Sprite {
color: SNAKE_HEAD_COLOR,
custom_size: Some(Vec2::new(10.0, 10.0)),
..default()
});
}
fn setup_camera(mut commands: Commands) {
commands.spawn((Camera2d {},));
}
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(WorldInspectorPlugin::new())
.add_systems(Startup, (setup_camera, setup_player))
.run();
}