about summary refs log tree commit diff
path: root/src/Xanthous/Data.hs
diff options
context:
space:
mode:
authorGriffin Smith <root@gws.fyi>2019-09-13T19·24-0400
committerGriffin Smith <root@gws.fyi>2019-09-13T19·24-0400
commitc06edf3cc698f36e995719dc6e192c5663110f6d (patch)
treedd7872fbad6dc4b0e04f943ef63a64c3e002479b /src/Xanthous/Data.hs
parent9ebdc6fbb446fea5e505172a6b3dd459beaf3552 (diff)
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.
Diffstat (limited to 'src/Xanthous/Data.hs')
-rw-r--r--src/Xanthous/Data.hs4
1 files changed, 4 insertions, 0 deletions
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