pub startpos

This commit is contained in:
2026-09-17 20:16:22 +02:00
parent 18c4db4e95
commit 8b07880e46
3 changed files with 20 additions and 1 deletions
+1
View File
@@ -13,6 +13,7 @@ mod camera;
mod collision; mod collision;
mod obstacle; mod obstacle;
mod player; mod player;
mod score;
fn main() { fn main() {
App::new() App::new()
+1 -1
View File
@@ -5,7 +5,7 @@ use crate::collision::{Collider, HasCollided};
const FALL_SPEED: f32 = 300.0; // Falling speed const FALL_SPEED: f32 = 300.0; // Falling speed
const DIVE_SPEED: f32 = 700.0; // Falling speed sped up const DIVE_SPEED: f32 = 700.0; // Falling speed sped up
const HORIZONTAL_SPEED: f32 = 300.0; // Lateral movement speed 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 // The player
#[derive(Component)] #[derive(Component)]
+18
View File
@@ -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<Depth>, player: Single<&Transform, With<Player>>) {
depth.0 = START_POSITION.y - player.translation.y;
}
fn spawn_depth_text() {
todo!()
}
fn update_depth_text() {
todo!()
}