adjust gravitation and jump

This commit is contained in:
nek0 2021-01-12 00:53:00 +01:00
parent 56779daa22
commit 6a4c0e5b42
3 changed files with 13 additions and 5 deletions

View File

@ -28,7 +28,7 @@ singleHandler level event = do
Jump -> if multiplier > 0 && pcGrounded pituicat
then A.log Debug "jumping"
(Just pituicat
{ pcVel = pcVel pituicat + V2 0 250
{ pcVel = pcVel pituicat + V2 0 300
, pcGrounded = False
}
)

View File

@ -11,6 +11,8 @@ import Data.String (fromString)
-- internal imports
import Util
import Classes.Graphics.Drawable
import Classes.Graphics.Bindable
import Classes.Prop
@ -67,11 +69,11 @@ instance Prop Pituicat where
instance Actor Pituicat where
perform dt p =
let physCat = (accelerate dt . gravitate (V2 0 (-250)))
let physCat = (accelerate dt . gravitate constG)
(p {pcAcc = 0})
(V2 _ dy) = pcVel physCat
finalCat = physCat
{ pcGrounded = pcGrounded physCat || (dy < 0 && abs dy < 1)
{ pcGrounded = pcGrounded physCat || (dy < 0 && abs dy < 2)
}
in
(A.log Debug ("moving with " <> fromString (show $ pcVel finalCat))) finalCat
@ -120,6 +122,6 @@ instance Collidible Pituicat where
(V2 _ dy) = pcVel ncat
in
ncat
{ pcGrounded = dy > 0 && abs dy < 1
{ pcGrounded = dy > 0 && abs dy < 2
}
)

View File

@ -5,9 +5,12 @@ import Affection
import qualified SDL
import qualified SDL.Internal.Numbered as SDL
import Linear
-- internal imports
import Types
import Types.Application
import Types.Subsystems
globalKeyHandle
:: GameData
@ -27,3 +30,6 @@ globalKeyHandle gd mesg@(MsgKeyboardEvent time win motion repeat keysym) =
else
return ()
_ -> return ()
constG :: V2 Double
constG = V2 0 (-500)