Jumpbacks and continue
This commit is contained in:
parent
dab6fadad4
commit
b7278d6afc
11 changed files with 59 additions and 44 deletions
|
@ -16,14 +16,17 @@ import RPGEngine.Data
|
|||
import Graphics.Gloss ( Picture, pictures )
|
||||
import Graphics.Gloss.Data.Picture (translate)
|
||||
import RPGEngine.Config (resolution, zoom)
|
||||
import Graphics.Gloss (text)
|
||||
import Graphics.Gloss (blank)
|
||||
|
||||
------------------------------ Exported ------------------------------
|
||||
|
||||
renderPlaying :: Renderer Game
|
||||
renderPlaying g@Game{ state = Playing { level = lvl }, player = player } = pictures [
|
||||
renderPlaying :: Renderer State
|
||||
renderPlaying Playing { level = lvl, player = player } = pictures [
|
||||
renderLevel lvl,
|
||||
renderPlayer player
|
||||
]
|
||||
renderPlaying _ = blank
|
||||
|
||||
------------------------------- Player -------------------------------
|
||||
|
||||
|
@ -35,7 +38,7 @@ renderPlayer Player{ position = (x, y) } = move picture
|
|||
-- Center the player in the middle of the screen.
|
||||
-- Not in use at the moment, might be useful later.
|
||||
focusPlayer :: Game -> Picture -> Picture
|
||||
focusPlayer Game{ player = Player{ position = (x, y)}} = move
|
||||
focusPlayer Game{ state = Playing{ player = Player{ position = (x, y) }}} = move
|
||||
where move = translate centerX centerY
|
||||
centerX = resolution * zoom * fromIntegral (negate x)
|
||||
centerY = resolution * zoom * fromIntegral (negate y)
|
||||
|
|
Reference in a new issue