Added intermittent rolling to NPCs during a chase

This commit is contained in:
Joshua Barretto 2020-01-27 16:18:36 +00:00
parent 8213748473
commit db21714a25

View File

@ -195,14 +195,15 @@ impl<'a> System<'a> for Sys {
.unwrap_or(Vec2::zero());
inputs.jump.set_state(bearing.z > 1.0);
}
if dist_sqrd < (MAX_CHASE_DIST * 0.65).powf(2.0)
&& thread_rng().gen::<f32>() < 0.01
{
inputs.roll.set_state(true);
}
} else {
do_idle = true;
}
// Sometimes try searching for new targets
if thread_rng().gen::<f32>() < 0.01 {
choose_target = true;
}
} else {
do_idle = true;
}