summaryrefslogtreecommitdiffstats
path: root/src/Collision.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Collision.hs')
-rw-r--r--src/Collision.hs17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/Collision.hs b/src/Collision.hs
index 6ce2df7..19e6ef5 100644
--- a/src/Collision.hs
+++ b/src/Collision.hs
@@ -20,7 +20,7 @@ bulletDiameter :: Coord
bulletDiameter = 0.05
collisionTankBorder :: Coord -> Coord -> Tank -> Tank
-collisionTankBorder lw lh tank = (translate dx dy) >< tank
+collisionTankBorder lw lh tank = V.Vector dx dy >< tank
where
corners = [ V.Vector (tankLength/2) (tankWidth/2)
, V.Vector (-tankLength/2) (tankWidth/2)
@@ -28,8 +28,8 @@ collisionTankBorder lw lh tank = (translate dx dy) >< tank
, V.Vector (tankLength/2) (-tankWidth/2)
]
- rotp v = V.rotateV (tankDir tank) >< v
- transp v = V.translateV v >< tankPos tank
+ rotp v = tankDir tank >< v
+ transp v = v >< tankPos tank
points = map (transp . rotp) corners
minx = minimum $ map V.vertexX points
@@ -50,7 +50,7 @@ collisionBulletTank (b, b') (tank, tank') = (not ((between bx minx maxx) && (bet
where
between x a b = x >= a && x <= b
- rotp t v = V.rotateV' (tankDir t) >< v
+ rotp t v = tankDir t >:< v
transp t v = V.diffV (tankPos t) v
V.Vector bx by = (rotp tank) . (transp tank) $ bulletPos b
@@ -61,7 +61,8 @@ collisionBulletTank (b, b') (tank, tank') = (not ((between bx minx maxx) && (bet
miny = -(tankWidth+bulletDiameter)/2
maxy = (tankWidth+bulletDiameter)/2
-collisionTankTank :: ((Tank, Tank), (Tank, Tank)) -> ((Tank, Tank), (Tank, Tank))
-collisionTankTank ((t1, t1'), (t2, t2')) = ((t1, t1'), (t2, t2'))
--- where
- \ No newline at end of file
+collisionTankTank :: ((Tank, Tank), (Tank, Tank)) -> (Tank, Tank)
+collisionTankTank ((t1, t1'), (t2, t2')) = (t1'', t2'')
+ where
+ t1'' = t1'
+ t2'' = t2'