Add random floor tiles to floors
This commit is contained in:
@@ -9,7 +9,7 @@ import Dodge.Config.KeyConfig
|
||||
import Dodge.Item.Data
|
||||
import Picture
|
||||
import Geometry
|
||||
import Picture.Texture
|
||||
--import Picture.Texture
|
||||
import Data.Tile
|
||||
import Tile
|
||||
|
||||
|
||||
+4
-1
@@ -9,6 +9,7 @@ import Dodge.Base
|
||||
import Dodge.Graph
|
||||
import Dodge.Layout.Tree.Polymorphic (applyToRoot)
|
||||
import Dodge.Room.Data
|
||||
import Dodge.Room.AddTile
|
||||
import Dodge.Default.Wall
|
||||
import Geometry
|
||||
import Dodge.Room.Link
|
||||
@@ -36,7 +37,9 @@ generateLevelFromRoomList gr w = updateWallZoning
|
||||
}
|
||||
where
|
||||
plmnts = concatMap _rmPS rs
|
||||
rs = evalState gr $ _randGen w
|
||||
rs = zipWith addTile zs rs'
|
||||
zs = map fromIntegral $ randomRs (0,(63::Int)) $ _randGen w
|
||||
rs' = evalState gr $ _randGen w
|
||||
|
||||
-- | connects a collection (tree) of rooms together
|
||||
generateFromTree :: State StdGen (Tree Room) -> World -> World
|
||||
|
||||
+4
-2
@@ -34,6 +34,7 @@ import Dodge.Room.Airlock
|
||||
import Dodge.Room.LongDoor
|
||||
import Geometry
|
||||
import Picture
|
||||
import Tile
|
||||
|
||||
import Control.Lens
|
||||
import Control.Monad.State
|
||||
@@ -214,14 +215,15 @@ roomCenterPillar = changeLinkTo ((\p -> dist p (120,0) < 10) . fst)
|
||||
|
||||
roomOctogon :: Room
|
||||
roomOctogon = defaultRoom
|
||||
{ _rmPolys = [[(-20,40),(20,40),(50,70),(50,110),(20,140),(-20,140),(-50,110),(-50,70)]
|
||||
]
|
||||
{ _rmPolys = [poly ]
|
||||
, _rmLinks = lnks
|
||||
, _rmPath = allPairs $ map fst lnks
|
||||
, _rmPS = []
|
||||
, _rmBound = [[(-20,30),(20,30),(60,70),(60,110),(20,150),(-20,150),(-60,110),(-60,70)] ]
|
||||
, _rmFloor = [oTile poly 7]
|
||||
}
|
||||
where
|
||||
poly = [(-20,40),(20,40),(50,70),(50,110),(20,140),(-20,140),(-50,110),(-50,70)]
|
||||
lnks =
|
||||
[((0,140),0)
|
||||
,((35,125),0-pi/4)
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
module Dodge.Room.AddTile
|
||||
where
|
||||
import Dodge.Room.Data
|
||||
import Tile
|
||||
import Geometry
|
||||
|
||||
import Control.Lens
|
||||
|
||||
addTile :: Float -> Room -> Room
|
||||
addTile z r
|
||||
| not (null (_rmFloor r)) || null rp = r
|
||||
| otherwise = r & rmFloor .~ [oTile poly z]
|
||||
where
|
||||
rp = _rmPolys r
|
||||
poly = convexHull $ concat rp
|
||||
@@ -3,21 +3,20 @@ module Dodge.Room.Corridor
|
||||
import Dodge.Room.Data
|
||||
import Dodge.Default.Room
|
||||
import Geometry
|
||||
import Tile
|
||||
{- | First exit due north, two other exits at angles next to this.
|
||||
Entrance from south. -}
|
||||
corridor :: Room
|
||||
corridor = defaultRoom
|
||||
{ _rmPolys = [rectNSWE 80 0 0 40
|
||||
--{ _rmPolys = [rectNSWE 90 (-10) 0 40
|
||||
-- ,[(0,80), (0,80) +.+ rotateV (pi/3) (40,0),(40,80)]
|
||||
-- ,[(40,0), (0,0) +.+ rotateV (0-pi/3) (40,0),( 0, 0)]
|
||||
]
|
||||
{ _rmPolys = [poly]
|
||||
, _rmLinks = lnks
|
||||
, _rmPath = concatMap (doublePair . (,) (20,60) . fst) lnks
|
||||
, _rmPS = []
|
||||
, _rmBound = [ rectNSWE 50 30 0 40 ]
|
||||
, _rmFloor = [oTile poly 2]
|
||||
}
|
||||
where
|
||||
poly = rectNSWE 80 0 0 40
|
||||
lnks =
|
||||
[((20,70) ,0)
|
||||
,((20,70), pi/6)
|
||||
|
||||
@@ -103,6 +103,7 @@ combineRooms r r' = defaultRoom
|
||||
, _rmPath = _rmPath r ++ _rmPath r'
|
||||
, _rmPS = _rmPS r ++ _rmPS r'
|
||||
, _rmBound = _rmBound r ++ _rmBound r'
|
||||
, _rmFloor = _rmFloor r ++ _rmFloor r'
|
||||
}
|
||||
--{- The top fourth of a room of a given height. -}
|
||||
--fourth
|
||||
|
||||
Reference in New Issue
Block a user