Improve pulse laser/ball hit detection
This commit is contained in:
@@ -14,6 +14,7 @@ module Dodge.WorldEvent.ThingsHit (
|
||||
wlHitPos,
|
||||
crHit,
|
||||
crWlPbHit,
|
||||
crWlPbHitZ,
|
||||
wlsHitUnsorted,
|
||||
isWalkable,
|
||||
) where
|
||||
@@ -66,6 +67,20 @@ crWlPbHit sp ep w =
|
||||
toobj (Left cr) = OCreature cr
|
||||
toobj (Right wl) = OWall wl
|
||||
|
||||
crWlPbHitZ :: Float -> Point2 -> Point2 -> World -> [(Point2, Object)]
|
||||
crWlPbHitZ z sp ep w =
|
||||
List.mergeOn
|
||||
(dist sp . fst)
|
||||
(map (fmap toobj) (thingsHitZ z sp ep w))
|
||||
pballs
|
||||
where
|
||||
-- slightly arbitrary
|
||||
pballs
|
||||
| z > 15 && z < 25 = map (fmap OPulseBall) (pbsHit sp ep w)
|
||||
| otherwise = mempty
|
||||
toobj (Left cr) = OCreature cr
|
||||
toobj (Right wl) = OWall wl
|
||||
|
||||
crsHit :: Point2 -> Point2 -> World -> [(Point2, Creature)]
|
||||
crsHit sp ep w
|
||||
| sp == ep = mempty
|
||||
|
||||
Reference in New Issue
Block a user