starter with a shape
This commit is contained in:
parent
e3fa910bd0
commit
34079860bf
@ -1,15 +1,16 @@
|
||||
use bevy::{color::palettes::css::{BLUE, PURPLE}, prelude::*};
|
||||
|
||||
|
||||
use bevy::prelude::*;
|
||||
pub mod shape;
|
||||
|
||||
fn main() {
|
||||
App::new()
|
||||
.insert_resource(ClearColor(Color::srgb(1.0, 1.0, 1.0)))
|
||||
.add_plugins(DefaultPlugins)
|
||||
.add_systems(Startup, setup)
|
||||
.add_systems(Update, shape::display_shape)
|
||||
.run();
|
||||
}
|
||||
|
||||
fn setup(mut commands: Commands){
|
||||
|
||||
fn setup(mut commands: Commands,) {
|
||||
commands.spawn(Camera2d);
|
||||
}
|
||||
|
||||
11
src/shape.rs
Normal file
11
src/shape.rs
Normal file
@ -0,0 +1,11 @@
|
||||
use bevy::prelude::*;
|
||||
|
||||
|
||||
pub fn display_shape(mut commands: Commands, mut meshes: ResMut<Assets<Mesh>>, mut materials: ResMut<Assets<ColorMaterial>>) {
|
||||
let shape = meshes.add(Capsule2d::new(25.0, 50.0));
|
||||
let color = Color::hsl(360. * 5 as f32 / 10 as f32, 0.95, 0.7);
|
||||
commands.spawn((
|
||||
Mesh2d(shape),
|
||||
MeshMaterial2d(materials.add(color)),
|
||||
Transform::from_xyz(100.0, 0.0, 0.0)));
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user