From c06edf3cc698f36e995719dc6e192c5663110f6d Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Fri, 13 Sep 2019 15:24:05 -0400 Subject: 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. --- src/Xanthous/Data.hs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/Xanthous/Data.hs') diff --git a/src/Xanthous/Data.hs b/src/Xanthous/Data.hs index e4355263846a..468e59217cce 100644 --- a/src/Xanthous/Data.hs +++ b/src/Xanthous/Data.hs @@ -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 -- cgit 1.4.1