Basic closeness check for floor items
This commit is contained in:
@@ -11,19 +11,12 @@ import Dodge.Render.ShapePicture
|
||||
import qualified Data.IntMap as IM
|
||||
worldShape :: World -> Shape
|
||||
worldShape w = _foregroundShape w
|
||||
<> mconcat (map (crShape w) (IM.elems $ IM.filter crIsClose (_creatures w)))
|
||||
<> mconcat (map (_spShape . floorItemSPic) $ IM.elems $ _floorItems w)
|
||||
<> mconcat (map (crShape w) (IM.elems $ IM.filter (pointIsClose . _crPos) (_creatures w)))
|
||||
<> mconcat (map (_spShape . floorItemSPic) $ IM.elems $ IM.filter (pointIsClose . _flItPos) $ _floorItems w)
|
||||
where
|
||||
crIsClose cr = dist (_crPos cr) camCen < winSize
|
||||
pointIsClose p = dist camCen p < winSize
|
||||
winSize = 30 + max (getWindowX w) (getWindowY w)
|
||||
camCen = _cameraCenter w
|
||||
|
||||
pointIsClose :: World -> Point2 -> Bool
|
||||
pointIsClose w p = dist p camCen < winSize
|
||||
where
|
||||
winSize = 30 + max (getWindowX w) (getWindowY w)
|
||||
camCen = _cameraCenter w
|
||||
|
||||
|
||||
crShape :: World -> Creature -> Shape
|
||||
crShape w c = _spShape $ _crPict c c w
|
||||
|
||||
@@ -5,6 +5,7 @@ import Geometry
|
||||
import ShapePicture
|
||||
|
||||
floorItemSPic :: FloorItem -> SPic
|
||||
floorItemSPic flit = uncurryV translateSPf (_flItPos flit)
|
||||
$ rotateSP (_flItRot flit) (_itFloorPict (_flIt flit))
|
||||
floorItemSPic flit
|
||||
= uncurryV translateSPf (_flItPos flit)
|
||||
$ rotateSP (_flItRot flit) (_itFloorPict (_flIt flit))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user