Allow for items to cast shadows

This commit is contained in:
2021-09-18 11:00:52 +01:00
parent 6ac53c052c
commit 2d8f1089a1
18 changed files with 236 additions and 172 deletions
+1 -1
View File
@@ -196,7 +196,7 @@ rectangleSolid x y = polygon $ map toV2 [(x,y),(x,-y),(-x,-y),(-x,y)]
drawItem :: FloorItem -> Picture
drawItem flit = uncurryV translate (_flItPos flit)
$ rotate (_flItRot flit) (_itFloorPict (_flIt flit))
$ rotate (_flItRot flit) (_spPicture $ _itFloorPict (_flIt flit))
ffToDraw :: World -> [ForceField]
+6 -1
View File
@@ -5,10 +5,15 @@ import Shape
import Geometry
import Color
import ShapePicture
import Dodge.Base.Window
import qualified Data.IntMap as IM
worldShape :: World -> Shape
worldShape w = mconcat (map (crShape w) (IM.elems (_creatures w)))
worldShape w = mconcat (map (crShape w) (IM.elems $ IM.filter crIsClose (_creatures w)))
where
crIsClose cr = dist (_crPos cr) camCen < winSize
winSize = 30 + max (getWindowX w) (getWindowY w)
camCen = _cameraCenter w
crShape :: World -> Creature -> Shape
crShape w c = _spShape $ _crPict c c w