better camera handling
This commit is contained in:
parent
705f032035
commit
66b8f54a07
1 changed files with 6 additions and 9 deletions
|
@ -135,7 +135,8 @@ drawInit = do
|
||||||
ad <- get
|
ad <- get
|
||||||
ud <- getAffection
|
ud <- getAffection
|
||||||
process (nodeGraph ud M.! "sink")
|
process (nodeGraph ud M.! "sink")
|
||||||
present (GeglRectangle 0 0 3289 600) (foreground ud) True
|
present (GeglRectangle (round $ cameraX ud) 0 800 600) (foreground ud) True
|
||||||
|
render Nothing Nothing
|
||||||
|
|
||||||
draw :: Affection UserData ()
|
draw :: Affection UserData ()
|
||||||
draw = do
|
draw = do
|
||||||
|
@ -181,14 +182,10 @@ update dt = do
|
||||||
"rect"
|
"rect"
|
||||||
(actors ud)
|
(actors ud)
|
||||||
let {
|
let {
|
||||||
offset | xpos - cameraX ud > 750 && cameraX ud + leg < 2489 =
|
offset | xpos - cameraX ud > 750 && cameraX ud + leg < 2489 && code == SDL.KeycodeRight =
|
||||||
case code of
|
leg
|
||||||
SDL.KeycodeRight -> leg
|
| xpos - cameraX ud < 50 && cameraX ud - leg > 0 && code == SDL.KeycodeLeft =
|
||||||
_ -> 0
|
(-leg)
|
||||||
| xpos - cameraX ud < 50 && cameraX ud - leg > 0 =
|
|
||||||
case code of
|
|
||||||
SDL.KeycodeLeft -> (-leg)
|
|
||||||
_ -> 0
|
|
||||||
| otherwise = 0
|
| otherwise = 0
|
||||||
}
|
}
|
||||||
putAffection ud
|
putAffection ud
|
||||||
|
|
Loading…
Reference in a new issue