This repository has been archived on 2025-03-03. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
htanks/src/Tank.hs

32 lines
No EOL
856 B
Haskell

module Tank ( Tank(..)
, tankX
, tankY
) where
import Transformable
import Vector
data Tank = Tank
{ tankPos :: !Vertex
, tankDir :: !Vector
, tankAim :: !Vector
, tankSpeed :: !Coord
, tankTurnspeed :: !Coord
, tankMoving :: !Bool
, 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