mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fixed enemy combat
This commit is contained in:
parent
23cfe50455
commit
8aa7af781e
@ -63,11 +63,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
Some(tgt_pos) => {
|
Some(tgt_pos) => {
|
||||||
let dist = Vec2::<f32>::from(tgt_pos.0 - pos.0).magnitude();
|
let dist = Vec2::<f32>::from(tgt_pos.0 - pos.0).magnitude();
|
||||||
if dist < 2.0 {
|
if dist < 2.0 {
|
||||||
controller.move_dir = if dist < 0.001 {
|
controller.move_dir = Vec2::zero();
|
||||||
Vec2::zero()
|
|
||||||
} else {
|
|
||||||
Vec2::<f32>::from(tgt_pos.0 - pos.0).normalized()
|
|
||||||
};
|
|
||||||
|
|
||||||
if rand::random::<f32>() < 0.05 {
|
if rand::random::<f32>() < 0.05 {
|
||||||
controller.attack = true;
|
controller.attack = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user