time travel: add random offsets to target that increase with difficulty
This commit is contained in:
parent
d856c8487a
commit
70c83295ca
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue