diff options
Diffstat (limited to 'src/setup.rs')
-rw-r--r-- | src/setup.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/setup.rs b/src/setup.rs new file mode 100644 index 0000000..6a6a5d0 --- /dev/null +++ b/src/setup.rs @@ -0,0 +1,26 @@ +use avian2d::prelude::{Collider, Mass, RigidBody}; +use bevy::{color::Color, core_pipeline::core_2d::Camera2d, ecs::system::Commands, math::Vec2, sprite::Sprite, transform::components::Transform}; + +use crate::StartPlanet; + +pub fn setup_starting_planet(mut cmd: Commands) { + let start_planet = StartPlanet { + display_name: String::from("Earth 2"), + planet_mass_kg: 15000.0, + radius: 10.0, + }; + let collider_radius = (&start_planet).radius; + let planet_mass_kg = (&start_planet).planet_mass_kg; + cmd.spawn(( + start_planet, + RigidBody::Static, + Transform::from_xyz(0.0, 0.0, 0.0), + Sprite::from_color(Color::WHITE, Vec2 { x: 5.0, y: 5.0 }), + Collider::circle(collider_radius), + Mass(planet_mass_kg), + )); +} +pub fn setup_init(mut commands: Commands) { + commands.spawn(Camera2d); + println!("Setup initial things"); +}
\ No newline at end of file |