Spawn logic
This commit is contained in:
parent
1a11e0d670
commit
f56ae2bc04
4 changed files with 49 additions and 2 deletions
|
|
@ -6,5 +6,19 @@ pub mod player;
|
|||
pub struct ShipsPlugin;
|
||||
|
||||
impl Plugin for ShipsPlugin {
|
||||
fn build(&self, app: &mut bevy::app::App) {}
|
||||
fn build(&self, app: &mut bevy::app::App) {
|
||||
app.insert_resource(Time::<Fixed>::from_hz(60.))
|
||||
.add_systems(Startup, startup)
|
||||
.add_systems(FixedUpdate, player::player_movement_system);
|
||||
}
|
||||
}
|
||||
|
||||
fn startup(mut commands: Commands, asset_server: Res<AssetServer>) {
|
||||
let player_sprite: Handle<Image> = asset_server.load("player.png");
|
||||
let enemy_sprite: Handle<Image> = asset_server.load("enemy.png");
|
||||
|
||||
commands.spawn(Camera2d);
|
||||
|
||||
player::spawn_player(&mut commands, player_sprite, Vec2::new(0., 0.));
|
||||
enemy::spawn_enemy(&mut commands, enemy_sprite.clone(), Vec2::new(100., 100.));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue