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:
Griffin Smith 2019-09-13 15:24:05 -04:00
parent 9ebdc6fbb4
commit c06edf3cc6
9 changed files with 171 additions and 34 deletions

View file

@ -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