diff options
Diffstat (limited to 'DefaultPlayer.hs')
-rw-r--r-- | DefaultPlayer.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/DefaultPlayer.hs b/DefaultPlayer.hs index 431b298..af9aaf5 100644 --- a/DefaultPlayer.hs +++ b/DefaultPlayer.hs @@ -21,8 +21,8 @@ instance Player DefaultPlayer where playerUpdate (DefaultPlayer keys aimx aimy shoot) tank = let x = (if (S.member KeyLeft keys) then (-1) else 0) + (if (S.member KeyRight keys) then 1 else 0) y = (if (S.member KeyDown keys) then (-1) else 0) + (if (S.member KeyUp keys) then 1 else 0) - ax = aimx - (fromRational . toRational $ posx tank) - ay = aimy - (fromRational . toRational $ posy tank) + ax = aimx - (fromRational . toRational . tankX $ tank) + ay = aimy - (fromRational . toRational . tankY $ tank) move = (x /= 0 || y /= 0) angle = if move then Just $ fromRational $ round ((atan2 y x)*1000000*180/pi)%1000000 else Nothing aangle = if (ax /= 0 || ay /= 0) then Just $ fromRational $ round ((atan2 ay ax)*1000000*180/pi)%1000000 else Nothing |