Decouple gravity from player velocities
This commit is contained in:
parent
d470f7e647
commit
be47dc21c7
5
go.mod
5
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
|
||||||
|
|
|
@ -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.
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user