Refine player movement and physics constants for improved 20 TPS gameplay, add reusable config values, enhance button loading states, and prevent duplicate game starts. Update cache-busting version for client assets.
All checks were successful
Dynamic Branch Deploy / build-and-deploy (push) Successful in 2m3s
All checks were successful
Dynamic Branch Deploy / build-and-deploy (push) Successful in 2m3s
This commit is contained in:
@@ -261,17 +261,17 @@ func (r *Room) HandleInput(input game.ClientInput) {
|
||||
switch input.Type {
|
||||
case "JUMP":
|
||||
if p.OnGround {
|
||||
p.VY = -30.0 // Reduziert für besseres Spielgefühl bei 20 TPS
|
||||
p.VY = -config.JumpVelocity
|
||||
p.OnGround = false
|
||||
p.DoubleJumpUsed = false // Reset double jump on ground jump
|
||||
} else if p.HasDoubleJump && !p.DoubleJumpUsed {
|
||||
// Double Jump in der Luft
|
||||
p.VY = -30.0 // Reduziert für besseres Spielgefühl bei 20 TPS
|
||||
p.VY = -config.JumpVelocity
|
||||
p.DoubleJumpUsed = true
|
||||
log.Printf("⚡ %s verwendet Double Jump!", p.Name)
|
||||
}
|
||||
case "DOWN":
|
||||
p.VY = 45.0 // war 15.0 bei 60 TPS (15.0 * 3)
|
||||
p.VY = config.FastFall
|
||||
case "LEFT_DOWN":
|
||||
p.InputX = -1
|
||||
case "LEFT_UP":
|
||||
@@ -355,11 +355,10 @@ func (r *Room) Update() {
|
||||
}
|
||||
|
||||
// X Bewegung
|
||||
// Symmetrische Geschwindigkeit: Links = Rechts
|
||||
// Nach rechts: CurrentSpeed + 33, Nach links: CurrentSpeed - 33
|
||||
// Verwendet r.CurrentSpeed statt config.RunSpeed für dynamische Geschwindigkeit
|
||||
// war 11.0 bei 60 TPS (11.0 * 3 = 33.0)
|
||||
currentSpeed := r.CurrentSpeed + (p.InputX * 33.0)
|
||||
// Spieler bewegt sich relativ zum Scroll
|
||||
// Scroll-Geschwindigkeit + Links/Rechts Bewegung
|
||||
playerMovement := p.InputX * config.PlayerSpeed
|
||||
currentSpeed := r.CurrentSpeed + playerMovement
|
||||
nextX := p.X + currentSpeed
|
||||
|
||||
hitX, typeX := r.CheckCollision(nextX+r.pDrawOffX+r.pHitboxOffX, p.Y+r.pDrawOffY+r.pHitboxOffY, r.pW, r.pH)
|
||||
@@ -408,13 +407,13 @@ func (r *Room) Update() {
|
||||
if p.OnWall {
|
||||
// Wandrutschen (langsame Fallgeschwindigkeit)
|
||||
p.VY += config.Gravity * 0.3 // 30% Gravität an der Wand
|
||||
if p.VY > 9.0 { // war 3.0 bei 60 TPS (3.0 * 3)
|
||||
p.VY = 9.0 // Maximal 9.0 beim Rutschen
|
||||
if p.VY > config.WallSlideMax {
|
||||
p.VY = config.WallSlideMax
|
||||
}
|
||||
|
||||
// Hochklettern wenn nach oben gedrückt (InputX in Wandrichtung)
|
||||
if p.InputX != 0 {
|
||||
p.VY = -15.0 // war -5.0 bei 60 TPS (-5.0 * 3)
|
||||
p.VY = -config.WallClimbSpeed
|
||||
}
|
||||
} else {
|
||||
// Normal: Volle Gravität
|
||||
|
||||
Reference in New Issue
Block a user