Decouple gravity from player velocities

loading-screen
Noah 2021-06-02 22:18:25 -07:00
parent d470f7e647
commit be47dc21c7
3 changed files with 8 additions and 2 deletions

5
go.mod
View File

@ -43,3 +43,8 @@ require (
replace git.kirsle.net/go/render => /home/kirsle/SketchyMaze/deps/render
replace git.kirsle.net/go/ui => /home/kirsle/SketchyMaze/deps/ui
replace git.kirsle.net/go/audio => /home/kirsle/SketchyMaze/deps/audio

View File

@ -15,8 +15,9 @@ var (
// Player speeds // Player speeds
PlayerMaxVelocity float64 = 6 PlayerMaxVelocity float64 = 6
PlayerAcceleration float64 = 0.2 PlayerAcceleration float64 = 0.9
Gravity float64 = 6 Gravity float64 = 6
GravityAcceleration float64 = 0.2
SlopeMaxHeight = 8 // max pixel height for player to walk up a slope SlopeMaxHeight = 8 // max pixel height for player to walk up a slope
// Default chunk size for canvases. // Default chunk size for canvases.

View File

@ -70,7 +70,7 @@ func (w *Canvas) loopActorCollision() error {
v.Y = physics.Lerp( v.Y = physics.Lerp(
v.Y, // current speed v.Y, // current speed
balance.Gravity, // target max gravity falling downwards balance.Gravity, // target max gravity falling downwards
balance.PlayerAcceleration, balance.GravityAcceleration,
) )
} else { } else {
v.Y = 0 v.Y = 0