diff --git a/src/camera.rs b/src/camera.rs index da5d5fc..05b2e80 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -6,38 +6,50 @@ pub struct CameraPlugin; impl Plugin for CameraPlugin { fn build(&self, app: &mut App) { - app.add_systems( - Startup, - (spawn_camera, move_camera) - ); + // Spawn in the camera on startup, only 1 instance + app.add_systems(Startup, spawn_camera); + + // We're so good.. + // Update the camera position ever game loop iteration + app.add_systems(Update, move_camera); } } fn spawn_camera(mut commands: Commands) { let mut camera = Camera2dBundle::default(); - camera.projection.scale = 0.5; - camera.transform.translation.x += 1280.0 / 4.0; - camera.transform.translation.y += 720.0 / 4.0; + // Bigger decimal, further it zooms in + // 0.5 is closer to level than 1.0 + camera.projection.scale = 0.3; + commands.spawn(camera); } +// THIS NEEDS TO BE IN THE UPDATE LOOP LOL +// We don't need to get player position to snap +// when spawning, it does that here lol +// - Mjork fn move_camera( mut camera: Query<&mut Transform, (With, Without)>, player: Query<&Transform, (With, Without)>, time: Res