diff options
Diffstat (limited to 'src/Tank.hs')
-rw-r--r-- | src/Tank.hs | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/src/Tank.hs b/src/Tank.hs index 2fbf612..f3230f2 100644 --- a/src/Tank.hs +++ b/src/Tank.hs @@ -1,18 +1,32 @@ module Tank ( Tank(..) + , tankX + , tankY ) where -import Data.Fixed +import Transformable +import Vector data Tank = Tank - { tankX :: !Micro - , tankY :: !Micro - , tankDir :: !Micro - , tankAim :: !Micro - , tankSpeed :: !Micro - , tankTurnspeed :: !Micro + { tankPos :: !Vertex + , tankDir :: !Vector + , tankAim :: !Vector + , tankSpeed :: !Coord + , tankTurnspeed :: !Coord , tankMoving :: !Bool - , tankBulletSpeed :: !Micro + , tankBulletSpeed :: !Coord , tankBulletBounces :: !Int , tankBulletsLeft :: !Int , tankLife :: !Int } deriving (Eq, Show) + +tankX :: Tank -> Coord +tankX = vertexX . tankPos + +tankY :: Tank -> Coord +tankY = vertexY . tankPos + +instance Transformable Tank where + t >< tank = tank { tankPos = pos, tankDir = dir, tankAim = aim } where + pos = t >< tankPos tank + dir = t >< tankDir tank + aim = t >< tankAim tank
\ No newline at end of file |