parent
de02c7113f
commit
fb4bc5bb36
12 changed files with 158 additions and 9 deletions
|
@ -7,6 +7,7 @@ module RPGEngine.Input
|
|||
import RPGEngine.Data
|
||||
import RPGEngine.Data.State
|
||||
import RPGEngine.Input.Core
|
||||
import RPGEngine.Input.Player
|
||||
|
||||
import Graphics.Gloss.Interface.IO.Game
|
||||
|
||||
|
@ -22,7 +23,19 @@ handleAllInput ev g = handleAnyKey setNextState ev g
|
|||
-- Input for 'Playing' state
|
||||
handlePlayInputs :: InputHandler Game
|
||||
handlePlayInputs = composeInputHandlers [
|
||||
handleKey (Char 'p') (\game -> game{ state = Pause })
|
||||
-- Pause the game
|
||||
handleKey (Char 'p') (\game -> game{ state = Pause }),
|
||||
|
||||
-- Player movement
|
||||
handleKey (SpecialKey KeyUp) $ movePlayer North,
|
||||
handleKey (SpecialKey KeyRight) $ movePlayer East,
|
||||
handleKey (SpecialKey KeyDown) $ movePlayer South,
|
||||
handleKey (SpecialKey KeyLeft) $ movePlayer West,
|
||||
|
||||
handleKey (Char 'w') $ movePlayer North,
|
||||
handleKey (Char 'd') $ movePlayer East,
|
||||
handleKey (Char 's') $ movePlayer South,
|
||||
handleKey (Char 'a') $ movePlayer West
|
||||
]
|
||||
|
||||
-- Go to the next stage of the Game
|
||||
|
|
Reference in a new issue