Place the chacracter in the level at startup time
Randomly select a position in the largest contiguous region of the generated level in which to place the character at startup time.
This commit is contained in:
parent
9ebdc6fbb4
commit
c06edf3cc6
9 changed files with 171 additions and 34 deletions
|
@ -15,6 +15,7 @@ module Xanthous.Data
|
|||
, position
|
||||
, positioned
|
||||
, loc
|
||||
, positionFromPair
|
||||
|
||||
-- *
|
||||
, Dimensions'(..)
|
||||
|
@ -91,6 +92,9 @@ loc = iso hither yon
|
|||
hither (Position px py) = Location (px, py)
|
||||
yon (Location (lx, ly)) = Position lx ly
|
||||
|
||||
positionFromPair :: (Integral i, Integral j) => (i, j) -> Position
|
||||
positionFromPair (i, j) = Position (fromIntegral i) (fromIntegral j)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
data Dimensions' a = Dimensions
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue