From 8b07880e46bd7b10dea2ceb9dedcf45c3ecf2e08 Mon Sep 17 00:00:00 2001 From: zefad Date: Thu, 17 Sep 2026 20:16:22 +0200 Subject: [PATCH] pub startpos --- src/main.rs | 1 + src/player.rs | 2 +- src/score.rs | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 src/score.rs diff --git a/src/main.rs b/src/main.rs index bcb100c..a700a65 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,6 +13,7 @@ mod camera; mod collision; mod obstacle; mod player; +mod score; fn main() { App::new() diff --git a/src/player.rs b/src/player.rs index 346c1d9..18b56bd 100644 --- a/src/player.rs +++ b/src/player.rs @@ -5,7 +5,7 @@ use crate::collision::{Collider, HasCollided}; const FALL_SPEED: f32 = 300.0; // Falling speed const DIVE_SPEED: f32 = 700.0; // Falling speed sped up const HORIZONTAL_SPEED: f32 = 300.0; // Lateral movement speed -const START_POSITION: Vec3 = Vec3::new(0.0, 0.0, 2.0); // Start position +pub const START_POSITION: Vec3 = Vec3::new(0.0, 0.0, 2.0); // Start position // The player #[derive(Component)] diff --git a/src/score.rs b/src/score.rs new file mode 100644 index 0000000..4a87641 --- /dev/null +++ b/src/score.rs @@ -0,0 +1,18 @@ +use bevy::prelude::*; + +use crate::player::{Player, START_POSITION}; + +#[derive(Resource)] +pub struct Depth(pub f32); + +fn update_depth(mut depth: ResMut, player: Single<&Transform, With>) { + depth.0 = START_POSITION.y - player.translation.y; +} + +fn spawn_depth_text() { + todo!() +} + +fn update_depth_text() { + todo!() +}