Private
Public Access
1
0

bug fixes
All checks were successful
Dynamic Branch Deploy / build-and-deploy (push) Successful in 1m37s

This commit is contained in:
Sebastian Unterschütz
2025-11-25 23:36:09 +01:00
parent 3bf339f0ec
commit fc8b22dd7c
8 changed files with 133 additions and 417 deletions

View File

@@ -5,12 +5,11 @@ const GRAVITY = 0.6;
const JUMP_POWER = -12;
const HIGH_JUMP_POWER = -16;
const GROUND_Y = 350;
const BASE_SPEED = 5;
const BASE_SPEED = 5.0;
const CHUNK_SIZE = 60;
const TARGET_FPS = 60;
const MS_PER_TICK = 1000 / TARGET_FPS;
// RNG Klasse
class PseudoRNG {
constructor(seed) {

View File

@@ -1,7 +1,8 @@
function updateGameLogic() {
// 1. Speed Berechnung (Sync mit Server!)
let currentSpeed = BASE_SPEED + (score / 750.0) * 0.5;
if (currentSpeed > 14.0) currentSpeed = 14.0;
let currentSpeed = BASE_SPEED + (score / 1000);
if (currentSpeed > 10.0) currentSpeed = 10.0;
// 2. Input & Sprung
if (isCrouching) inputLog.push({ t: currentTick - lastSentTick, act: "DUCK" });
@@ -113,7 +114,36 @@ function updateGameLogic() {
}
function checkCollision(p, obs) {
const paddingX = 5; const paddingY_Top = 5; const paddingY_Bottom = 5;
return (p.x + p.w - paddingX > obs.x + paddingX && p.x + paddingX < obs.x + obs.def.width - paddingX &&
p.y + p.h - paddingY_Bottom > obs.y + paddingY_Top && p.y + paddingY_Top < obs.y + obs.def.height - paddingY_Bottom);
const paddingX = 10;
const realRightEdge = obs.x + obs.def.width - paddingX;
if (realRightEdge < p.x + 5) {
return false;
}
const paddingY_Top = (obs.def.type === "teacher") ? 25 : 10;
const paddingY_Bottom = 5;
// Geschwindigkeit schätzen (oder global holen) für CCD
let currentSpeed = 5 + (score / 5000.0) * 0.5; // /5000 weil score hier /10 ist?
// Moment, in main.js ist 'score' der rohe Wert. Also /500.
// Da wir score global haben:
currentSpeed = 5 + (score / 500.0) * 0.5;
if (currentSpeed > 12.0) currentSpeed = 12.0;
const pLeft = p.x + paddingX;
const pRight = p.x + p.w - paddingX;
const pTop = p.y + paddingY_Top;
const pBottom = p.y + p.h - paddingY_Bottom;
const oLeft = obs.x + paddingX;
// CCD Erweiterung
const oRight = obs.x + obs.def.width - paddingX + currentSpeed;
const oTop = obs.y + paddingY_Top;
const oBottom = obs.y + obs.def.height - paddingY_Bottom;
return (pRight > oLeft && pLeft < oRight && pBottom > oTop && pTop < oBottom);
}

View File

@@ -93,7 +93,7 @@ function drawGame() {
if(obs.speech) drawSpeechBubble(obs.x, obs.y, obs.speech);
});
/*
// --- DEBUG RAHMEN (Server Hitboxen) ---
// Grün im Spiel, Rot bei Tod
ctx.strokeStyle = isGameOver ? "red" : "lime";
@@ -101,7 +101,6 @@ function drawGame() {
serverObstacles.forEach(srvObs => {
ctx.strokeRect(srvObs.x, srvObs.y, srvObs.w, srvObs.h);
});
*/
// --- SPIELER ---
@@ -130,7 +129,7 @@ function drawGame() {
// Drift Info (nur wenn Objekte da sind)
if (obstacles.length > 0 && serverObstacles.length > 0) {
const drift = Math.abs(obstacles[0].x - serverObstacles[0].x).toFixed(1);
// statusText += ` | Drift: ${drift}px`; // Einkommentieren für Debugging
statusText += ` | Drift: ${drift}px`; // Einkommentieren für Debugging
}
if(statusText !== "") {