Files
loop/src/Dodge/Room/Start.hs
T

37 lines
1.2 KiB
Haskell

module Dodge.Room.Start
where
import Dodge.Room.Data
import Dodge.Room.Door
import Dodge.Room.Link
import Dodge.Room.Procedural
import Dodge.Room.Placement
import Dodge.Room.Foreground
import Dodge.Layout.Tree.Polymorphic
import Dodge.LevelGen.Data
--import Picture
import Geometry.Data
import Data.Tree
import Control.Monad.State
import Control.Lens
import System.Random
rezBox :: Room
rezBox = shiftRoomBy (V2 (-20) (-10),0) $ roomRect 40 20 1 1 & rmPS .~ []
startRoom :: RandomGen g => State g (Tree (Either Room Room))
startRoom = do
w <- state $ randomR (100,400)
h <- state $ randomR (200,400)
let fground = sPS (V2 0 0) 0 $ PutForeground $
highPipe 80 (V2 0 (h/3)) (V2 w (h/2))
<> highPipe 40 (V2 0 (h/2)) (V2 w (h/3))
<> highPipe 60 (V2 (w/3) 0 ) (V2 (w/3) h )
theLamp = sPS (V2 (w/2) (h/2)) 0 $ putColorLamp (V3 0.75 0.75 0.75)
treeFromPost [Left rezBox, Left door] . Right
<$> randomiseOutLinks (shiftRoomBy (V2 (-20) (-20),0)
$ roomRectAutoLinks w h & rmPS .~ [fground,theLamp])
-- where
-- cola = dark . dark . light . light $ light red
-- colb = dark . dark . light . light $ light blue