This commit is contained in:
33333-33333 2026-06-19 23:22:15 +09:00
commit 33234f32ae
18 changed files with 1390 additions and 573 deletions

View file

@ -120,6 +120,8 @@ class Item {
if (this.y < p) { this.y = p; this.vy = Math.abs(this.vy || 0) * 0.72; this.spinVelocity *= -0.72; }
if (this.y > worldRef.h - p) { this.y = worldRef.h - p; this.vy = -Math.abs(this.vy || 0) * 0.72; this.spinVelocity *= -0.72; }
this.resolveBallObstacleCollisions(dt, worldRef);
this.x = clamp(this.x, p, worldRef.w - p);
this.y = clamp(this.y, p, worldRef.h - p);
clampVelocity();
const groundFriction = Math.pow(0.72, dt);
this.vx *= groundFriction;
@ -135,6 +137,8 @@ class Item {
const speed = Math.hypot(this.vx || 0, this.vy || 0);
const searchRadius = Math.max(130, (this.r || 18) + speed * Math.max(dt || 0.016, 0.016) + 96);
const items = worldRef.nearbyItems(this.x, this.y, searchRadius) || [];
let fenceChecks = 0;
const maxFenceChecks = CONFIG.maxFenceCollisionChecks ?? 18;
for (const it of items) {
if (!it || it === this || it.dead) continue;
if (it.type === "bed") {
@ -142,6 +146,8 @@ class Item {
} else if (it.type === "stone") {
this.resolveBallCircleBounce(it, (it.r || 20) * 1.08 + (this.r || 18), 0.82, worldRef);
} else if (it.type === "fence_v" || it.type === "fence_h") {
if (fenceChecks >= maxFenceChecks) continue;
fenceChecks += 1;
this.resolveBallFenceBounce(it, worldRef);
}
}
@ -467,7 +473,7 @@ class Item {
const shadow = projectedShadowParams(lightState, Math.max(0.4, this.r / 18));
if (this.type !== "trace" && this.type !== "splat") {
const zunchiId = this.type === "zunchi" ? (this.zunchiVariant || "zunchi") : null;
const zunchiImg = zunchiId ? (images.get(zunchiId) || images.get("zunchi")) : null;
const zunchiImg = zunchiId ? (typeof getRenderableImage === "function" ? getRenderableImage(zunchiId, "zunchi") : (images.get(zunchiId) || images.get("zunchi"))) : null;
if (zunchiImg) {
const metrics = getImageMetrics(zunchiId || "zunchi") || getImageMetrics("zunchi");
const ratio = metrics?.ratio || 178 / 236;
@ -528,7 +534,7 @@ class Item {
ctx.font = `${Math.round((this.r || 13) * 1.15)}px sans-serif`;
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillText("❤", 0, 1);
ctx.fillText("\u2764", 0, 1);
ctx.fillStyle = "rgba(255,255,255,0.55)";
ctx.beginPath();
ctx.ellipse(-this.r * 0.28, -this.r * 0.18, this.r * 0.23, this.r * 0.10, -0.35, 0, Math.PI * 2);
@ -538,7 +544,7 @@ class Item {
ctx.font = `${Math.round((this.r || 13) * 1.02)}px sans-serif`;
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillText("✦", 0, 1);
ctx.fillText("\u2726", 0, 1);
ctx.strokeStyle = "rgba(168,76,42,0.72)";
ctx.lineWidth = 1.4;
ctx.beginPath();
@ -637,7 +643,7 @@ class Item {
ctx.font = `${Math.round((this.r || 18) * 2.0)}px "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif`;
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillText("⚽", 0, 1);
ctx.fillText("\u26bd", 0, 1);
if (moving > 0.55) {
ctx.globalAlpha = 0.14 + moving * 0.10;
ctx.shadowColor = "transparent";