fix game
All checks were successful
Dynamic Branch Deploy / build-and-deploy (push) Successful in 6m49s
All checks were successful
Dynamic Branch Deploy / build-and-deploy (push) Successful in 6m49s
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"git.zb-server.de/ZB-Server/EscapeFromTeacher/pkg/config"
|
||||
"git.zb-server.de/ZB-Server/EscapeFromTeacher/pkg/game"
|
||||
"git.zb-server.de/ZB-Server/EscapeFromTeacher/pkg/physics"
|
||||
)
|
||||
@@ -31,6 +32,17 @@ func (g *Game) ApplyInput(input InputState) {
|
||||
OnWall: g.predictedOnWall,
|
||||
}
|
||||
|
||||
// Double Jump: vor der Physik anwenden (1:1 wie Server)
|
||||
if input.Jump && !g.predictedGround && g.predictedHasDoubleJump && !g.predictedDoubleJumpUsed {
|
||||
g.predictedVY = -config.JumpVelocity
|
||||
g.predictedDoubleJumpUsed = true
|
||||
}
|
||||
|
||||
// Double Jump Reset wenn wieder am Boden
|
||||
if g.predictedGround {
|
||||
g.predictedDoubleJumpUsed = false
|
||||
}
|
||||
|
||||
// Physik-Input vorbereiten
|
||||
physicsInput := physics.PhysicsInput{
|
||||
InputX: moveX,
|
||||
@@ -175,4 +187,8 @@ func (g *Game) ReconcileWithServer(serverState game.PlayerState) {
|
||||
g.predictedVY = replayVY
|
||||
g.predictedGround = replayGround
|
||||
g.predictedOnWall = replayOnWall
|
||||
|
||||
// Powerup-State vom Server übernehmen (autoritativ)
|
||||
g.predictedHasDoubleJump = serverState.HasDoubleJump
|
||||
g.predictedDoubleJumpUsed = serverState.DoubleJumpUsed
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user