Fixes badAiming

This commit is contained in:
BergesJ 2017-05-17 13:12:01 +02:00 committed by GitHub
parent ff47728b5b
commit d26f38ea6c

View File

@ -101,11 +101,11 @@ updateBoss pos w =
_ -> w
-- | Calculates the approximate direction of the hero.
badAiming :: DirVector -> DirVector
badAiming relPos =
case abs <$> relPos of
p | p^._x < p^._y -> signum relPos & _x .~ 0
| otherwise -> signum relPos & _y .~ 0
badAiming :: V2 Integer -> V2 Integer
badAiming relPos =
case relPos^._x.to (abs) < relPos^._y.to (abs) of
True -> signum relPos & _x .~ 0
False -> signum relPos & _y .~ 0
-- | If possible, this function moves the hero into a given direction by calling the function moveFrom.
-- Otherwise, only the orientation is changed towards the intended direction of movement.