Reogranise drawing in main
This commit is contained in:
@@ -5,6 +5,7 @@ import Dodge.Base
|
||||
import Dodge.Default
|
||||
import Dodge.CreatureState
|
||||
import Dodge.LightSources
|
||||
import Dodge.WorldEvent.Flash
|
||||
|
||||
import Dodge.WorldEvent.Sound
|
||||
|
||||
@@ -34,7 +35,7 @@ updateLamp :: Int -> CRUpdate
|
||||
updateLamp i = unrandUpdate handleLS internalUpdate
|
||||
where
|
||||
handleLS cr w
|
||||
| _crHP cr < 0 = mkSoundBreakGlass w & lightSources %~ IM.delete i
|
||||
| _crHP cr < 0 = explosionFlashAt (_crPos cr) $ mkSoundBreakGlass w & lightSources %~ IM.delete i
|
||||
| otherwise = w & lightSources . ix i . lsPos .~ _crPos cr
|
||||
internalUpdate cr
|
||||
| _crHP cr < 0 = Nothing
|
||||
|
||||
@@ -40,18 +40,17 @@ wallBuffer = 3
|
||||
|
||||
-- the following tests whether or not a point is on a wall, and if so pushes it
|
||||
-- out from the wall
|
||||
-- If the resultant push out is itself on another wall, the original point is
|
||||
-- returned
|
||||
-- this is then repeated if the point ends up on a new wall
|
||||
collideWalls :: Float -> Point2 -> [[Point2]] -> Point2 -> Point2
|
||||
collideWalls rad cp1 walls cp2
|
||||
= case (listToMaybe.mapMaybe (pushOutFromWall rad cp2)) walls of
|
||||
Nothing -> cp2
|
||||
Just cp3 -> case (listToMaybe.reverse.mapMaybe (pushOutFromWall rad cp3)) walls of
|
||||
Nothing -> cp3
|
||||
Just cp4 -> cp1
|
||||
Just cp4 -> cp4
|
||||
|
||||
-- pushes a point out from a list of walls
|
||||
-- if multiple new points occur, chooses the one closest to the orignal pointjk
|
||||
-- if multiple new points occur, chooses the one closest to the orignal point
|
||||
pushOutFromWalls :: Float -> [[Point2]] -> Point2 -> Point2
|
||||
pushOutFromWalls rad walls p =
|
||||
fromMaybe p
|
||||
|
||||
@@ -59,7 +59,7 @@ glareBetween t len wdth col a b w
|
||||
|
||||
lowLightPic :: Float -> Float -> Color -> (Point2, Point2) -> World -> Picture
|
||||
lowLightPic len wdth col (a,b) w
|
||||
= case thingsHitLongLine a b w of
|
||||
= case thingsHit a b w of
|
||||
((p, E3x2 wall):_)
|
||||
-> setCol . lineOfThickness wdth $ [alongLineBy len p wa, alongLineBy len p wb]
|
||||
where x = len *.* (normalizeV $ wa -.- wb)
|
||||
|
||||
@@ -17,6 +17,7 @@ thingsHit sp ep w
|
||||
where
|
||||
hitCrs = IM.elems $ IM.filter (\cr -> circOnLine sp ep (_crPos cr) (_crRad cr))
|
||||
$ _creatures w
|
||||
-- $ creaturesAlongLine sp ep w
|
||||
crPs = map (\cr -> ssaTriPoint ep (_crPos cr) sp (_crRad cr)) hitCrs
|
||||
crs = zip crPs (map E3x1 hitCrs)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user