spawn snake head
This commit is contained in:
@ -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();
|
||||
}
|
||||
|
Reference in New Issue
Block a user