spawn snake head
This commit is contained in:
788
Cargo.lock
generated
788
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -15,6 +15,8 @@ edition = "2021"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy = { version = "0.15.0", features = ["dynamic_linking"] }
|
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.
|
# Enable a small amount of optimization in the dev profile.
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
|
@ -1,3 +1,27 @@
|
|||||||
fn main() {
|
use bevy::prelude::*;
|
||||||
App::new().add_plugins(DefaultPlugins).run();
|
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();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user