diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-06-26 20:55:51 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-06-26 20:55:51 +0200 |
commit | cc53496bab9ad2bbfc3fb2868cd10fa46f612e69 (patch) | |
tree | f974028160c90e5a373c3ac38d8d7229c419aaa7 /src/DefaultPlayer.hs | |
parent | 8f1fd98cd69659446b9fdd11c0f3d2b860d779f7 (diff) | |
download | htanks-cc53496bab9ad2bbfc3fb2868cd10fa46f612e69.tar htanks-cc53496bab9ad2bbfc3fb2868cd10fa46f612e69.zip |
Reworked Transform as a type class
Diffstat (limited to 'src/DefaultPlayer.hs')
-rw-r--r-- | src/DefaultPlayer.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/DefaultPlayer.hs b/src/DefaultPlayer.hs index 00dce95..4ac6bac 100644 --- a/src/DefaultPlayer.hs +++ b/src/DefaultPlayer.hs @@ -30,8 +30,8 @@ instance Player DefaultPlayer where ax = realToFrac $ aimx - (fromRational . toRational . tankX $ tank) ay = realToFrac $ aimy - (fromRational . toRational . tankY $ tank) move = (x /= 0 || y /= 0) - dir = if move then Just (normalized $ Vector x y) else Nothing - adir = if (ax /= 0 || ay /= 0) then Just (normalized $ Vector ax ay) else Nothing + dir = if move then Just (fromVector $ Vector x y) else Nothing + adir = if (ax /= 0 || ay /= 0) then Just (fromVector $ Vector ax ay) else Nothing in return (DefaultPlayer keys aimx aimy False, dir, move, adir, shoot) handleEvent (DefaultPlayer keys aimx aimy shoot) ev |