use std::path::PathBuf; use bevy::{prelude::*, render::camera::Camera}; use bevy_ldtk::*; fn main() { App::build() .add_plugins(DefaultPlugins) .add_plugin(LdtkPlugin) .add_startup_system(setup.system()) .add_system(camera_movement.system()) .add_system(spawn_player.system()) .run(); } fn setup(mut commands: Commands, asset_server: Res) { // Enable hot reload asset_server.watch_for_changes().unwrap(); commands // Spawn the map .spawn() .insert_bundle(LdtkMapBundle { map: asset_server.load(PathBuf::from( &std::env::args().nth(1).unwrap_or("map1.ldtk".into()), )), config: LdtkMapConfig { set_clear_color: true, scale: 1.0, level: std::env::args() .nth(2) .map(|x| x.parse().unwrap()) .unwrap_or(0), center_map: false, }, ..Default::default() }); // And the camera commands .spawn() .insert_bundle(OrthographicCameraBundle::new_2d()); } const SPEED: f32 = 1.0; fn camera_movement( time: Res