Add room foregrounds

This commit is contained in:
2021-06-16 18:18:03 +02:00
parent 29902b6f22
commit 04ed034a3e
6 changed files with 84 additions and 37 deletions
+29
View File
@@ -0,0 +1,29 @@
module Dodge.Room.Start
where
import Dodge.Room.Data
import Dodge.Room.Link
import Dodge.Room.Procedural
import Dodge.Room.Foreground
import Dodge.LevelGen.Data
import Picture
--import Geometry
import Data.Tree
import Control.Monad.State
import Control.Lens
import System.Random
startRoom :: RandomGen g => State g (Tree (Either Room Room))
startRoom = do
w <- state $ randomR (100,400)
h <- state $ randomR (200,400)
let fground = sPS (0,0) 0 $ PutForeground $ pictures
[ highDiagonalMesh (0,0) (0,h) w 25
--, setDepth (-0.1) $ color orange $ pictures
-- [ polygon $ rectNSEW 50 40 140 (-20)
-- , translate 60 45 $ scale 0.5 1 $ thickArc 0 pi 75 10
-- , translate (-20) 300 $ polygon $ rectNSEW 10 0 40 0
-- ]
, highDiagonalMesh (w,0) (0,0) h 25
]
pure . Right <$> randomiseOutLinks (shiftRoomBy ((-20,-20),0) $ roomRectAutoLinks w h & rmPS %~ (fground :))