From be47dc21c79fa0c9c14e47af47f885f30da88cd8 Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Wed, 2 Jun 2021 22:18:25 -0700 Subject: [PATCH] Decouple gravity from player velocities --- go.mod | 5 +++++ pkg/balance/numbers.go | 3 ++- pkg/uix/actor_collision.go | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index aec88d5..5ec47b1 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/pkg/balance/numbers.go b/pkg/balance/numbers.go index b72ec76..9db93a8 100644 --- a/pkg/balance/numbers.go +++ b/pkg/balance/numbers.go @@ -15,8 +15,9 @@ var ( // Player speeds PlayerMaxVelocity float64 = 6 - PlayerAcceleration float64 = 0.2 + PlayerAcceleration float64 = 0.9 Gravity float64 = 6 + GravityAcceleration float64 = 0.2 SlopeMaxHeight = 8 // max pixel height for player to walk up a slope // Default chunk size for canvases. diff --git a/pkg/uix/actor_collision.go b/pkg/uix/actor_collision.go index 53e3cc7..e6a2acf 100644 --- a/pkg/uix/actor_collision.go +++ b/pkg/uix/actor_collision.go @@ -70,7 +70,7 @@ func (w *Canvas) loopActorCollision() error { v.Y = physics.Lerp( v.Y, // current speed balance.Gravity, // target max gravity falling downwards - balance.PlayerAcceleration, + balance.GravityAcceleration, ) } else { v.Y = 0