diff --git a/src/game.rs b/src/game.rs index 612e0ba..9ec7c5b 100644 --- a/src/game.rs +++ b/src/game.rs @@ -17,6 +17,7 @@ use bevy::prelude::*; use bevy::scene::SceneInstance; use bevy::window::{PrimaryWindow, Window, WindowMode}; use bevy_xpbd_3d::prelude::*; +use fastrand; use std::collections::HashMap; pub const CHEAT_WARP_1: &str = "pizzeria"; @@ -770,8 +771,14 @@ fn handle_race( if spawn_target { race.timeout = time.elapsed_seconds_f64() + 5.0; + let difficulty = 2.0 * race.score as f64; let mut delta = DVec3::new(0.0, 0.0, 100.0); delta = (player_trans.rotation * delta.as_vec3()).as_dvec3(); + delta += DVec3::new( + (fastrand::f64() - 0.5) * difficulty, + (fastrand::f64() - 0.5) * difficulty, + (fastrand::f64() - 0.5) * difficulty, + ); *target_pos = Position(player_pos.0 + delta); *target_v = *player_v; *target_vis = Visibility::Inherited;