This commit is contained in:
2022-04-07 21:39:39 +01:00
parent 9d4b1d5d70
commit 100f776ddd
11 changed files with 46 additions and 99 deletions
+3 -5
View File
@@ -16,9 +16,8 @@ import Data.Maybe
yourControl :: Creature -> World -> World
yourControl cr w = w
& updateUsingInput
& creatures . ix (_crID cr) %~ (mouseActionsCr (_mouseButtons w) . wasdWithAiming w speed)
where
speed = _mvSpeed $ _crMvType cr
& creatures . ix (_crID cr) %~
(mouseActionsCr (_mouseButtons w) . wasdWithAiming w (_mvSpeed $ _crMvType cr))
{- | Turn key presses into creature movement. -}
wasdWithAiming
@@ -51,8 +50,7 @@ wasdWithAiming w speed cr
isReloading = _posture (_crStance cr) == Reloading
mouseDir = case cr ^? crInv . ix (_crInvSel cr) . itScope . scopePos of
Just p -> normalizeAngle $ argV
$ p +.+ 2 / _cameraZoom w
*.* rotateV (_cameraRot w) (_mousePos w)
$ p +.+ 2 / _cameraZoom w *.* rotateV (_cameraRot w) (_mousePos w)
_ -> normalizeAngle $ argV (_mousePos w) + _cameraRot w
wasdM :: SDL.Scancode -> Point2