diff options
Diffstat (limited to 'src/HWiidPlayer.hs')
-rw-r--r-- | src/HWiidPlayer.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/HWiidPlayer.hs b/src/HWiidPlayer.hs index d98b9c9..9517394 100644 --- a/src/HWiidPlayer.hs +++ b/src/HWiidPlayer.hs @@ -55,11 +55,11 @@ instance Player HWiidPlayer where (aimx, aimy) = if null aims then (0, 0) else mulV (1/(fromIntegral $ length aims)) (foldr addV (0, 0) aims) ax = realToFrac $ aimx - (fromRational . toRational . tankX $ tank) ay = realToFrac $ aimy - (fromRational . toRational . tankY $ tank) - aim = if (ax /= 0 || ay /= 0) then Just $ V.Vector ax ay else Nothing + aim = if (ax /= 0 || ay /= 0) then Just . V.fromVector $ V.Vector ax ay else Nothing move = (mx /= 0 || my /= 0) angle = atan2 my mx - dir = if move then Just $ T.rotate (fromRational $ round ((angle - (sin $ 8*x)/8)*1000000*180/pi)%1000000) T.>< V.Vector 1 0 else Nothing + dir = if move then Just $ V.fromAngle (fromRational $ round ((angle - (sin $ 8*x)/8)*1000000)%1000000) else Nothing when foo $ print state return (HWiidPlayer wiimote cal aims, dir, move, aim, shoot) |