38 lines
1.0 KiB
Haskell
38 lines
1.0 KiB
Haskell
{- Specification of rooms that teleport (between levels). -}
|
|
module Dodge.Room.Teleport where
|
|
|
|
import Control.Lens
|
|
import Control.Monad.State
|
|
import Dodge.Data.GenWorld
|
|
import Dodge.LevelGen.PlacementHelper
|
|
import Dodge.Placement.Instance
|
|
import Dodge.Room.Procedural
|
|
import Geometry
|
|
import Picture
|
|
import System.Random
|
|
|
|
telRoomLev ::
|
|
RandomGen g =>
|
|
-- | Level number to teleport to
|
|
Int ->
|
|
State g Room
|
|
telRoomLev _ = do
|
|
w <- state $ randomR (200, 300)
|
|
h <- state $ randomR (200, 300)
|
|
return $
|
|
roomRectAutoLinks w h & rmPmnts
|
|
.~ [ sPS (V2 (w / 2) (h / 2)) 0 $ PutPPlate telPP
|
|
, sPS (V2 (w / 2) (h / 2 + 30)) 0 putLamp
|
|
]
|
|
where
|
|
telPP =
|
|
PressPlate
|
|
{ _ppPict = setDepth 0.5 . color red $ polygon ppFootprint
|
|
, _ppPos = V2 0 0
|
|
, _ppRot = 0
|
|
, _ppEvent = PPLevelReset
|
|
, _ppID = 0
|
|
, _ppText = "NEW LEVEL"
|
|
}
|
|
ppFootprint = reverse $ rectNSWE 20 (-20) (-20) 20
|