bug fixes
All checks were successful
Dynamic Branch Deploy / build-and-deploy (push) Successful in 1m37s
All checks were successful
Dynamic Branch Deploy / build-and-deploy (push) Successful in 1m37s
This commit is contained in:
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user