Restruction room code
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
{-
|
||||
Collections of rooms that branch into multiple paths.
|
||||
-}
|
||||
module Dodge.Room.Branch
|
||||
where
|
||||
import Geometry
|
||||
import Dodge.Room.Data
|
||||
import Dodge.Room.Door
|
||||
import Dodge.Room.Link
|
||||
import Dodge.Room.Procedural
|
||||
import Dodge.LevelGen.Data
|
||||
import Dodge.Layout.Tree.Polymorphic
|
||||
|
||||
import Control.Monad.State
|
||||
import System.Random
|
||||
import Data.Tree
|
||||
|
||||
branchRectWith :: RandomGen g => State g (Tree (Either Room Room)) -> State g (Tree (Either Room Room))
|
||||
branchRectWith t = do
|
||||
x <- state $ randomR (100,200)
|
||||
y <- state $ randomR (100,200)
|
||||
b <- t
|
||||
root <- randomiseOutLinks $ roomRectAutoLinks x y
|
||||
return $ Node (Left root) [Node (Right door) [], fmap rToL $ treeTrunk [Left door] b]
|
||||
where rToL :: Either a a -> Either a a
|
||||
rToL (Right r) = Left r
|
||||
rToL (Left r) = Left r
|
||||
Reference in New Issue
Block a user