Skip to content

Commit 000c7a7

Browse files
committed
feat: update debug grid drawing to match jump-thru rendered height
1 parent c77d2a0 commit 000c7a7

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/GameScene.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { COLORS, PLAYER_CONFIG, VIEWPORT, WORLD } from "./constants";
44
import { EntityWorld, spikeTriangles } from "./entities/EntityWorld";
55
import { Grid } from "./entities/core/Grid";
66
import { Hitbox } from "./entities/core/Hitbox";
7-
import { type RefillPickupEntity } from "./entities/runtime";
7+
import { JumpThruTilesEntity, type RefillPickupEntity } from "./entities/runtime";
88
import { CameraKillboxSpec, CameraLockMode, RefillType } from "./entities/types";
99
import { TILE_JUMP_THROUGH, tileAt } from "./grid";
1010
import {
@@ -115,6 +115,7 @@ const DEATH_SHAKE_INTENSITY = 0.0026;
115115
const SPAWN_WIPE_HEIGHT = VIEWPORT.height + SPAWN_WIPE_VISUALS.edgeOverscan * 2;
116116
const DEBUG_HITBOX_COLOR = 0xff0000;
117117
const DEBUG_HURTBOX_COLOR = 0x00ff00;
118+
const DEBUG_JUMP_THRU_HEIGHT = JUMP_THRU_EDGE_HEIGHT + JUMP_THRU_BODY_HEIGHT;
118119
const EMPTY_INPUT: InputState = {
119120
x: 0,
120121
y: 0,
@@ -1463,7 +1464,10 @@ export class GameScene extends Phaser.Scene {
14631464
}
14641465

14651466
if (entity.collider instanceof Grid) {
1466-
this.drawDebugGrid(entity.collider);
1467+
this.drawDebugGrid(
1468+
entity.collider,
1469+
entity instanceof JumpThruTilesEntity ? DEBUG_JUMP_THRU_HEIGHT : entity.collider.cellHeight,
1470+
);
14671471
continue;
14681472
}
14691473

@@ -1484,7 +1488,7 @@ export class GameScene extends Phaser.Scene {
14841488
this.drawDebugBounds(this.player.getHurtboxBounds(), DEBUG_HURTBOX_COLOR);
14851489
}
14861490

1487-
private drawDebugGrid(grid: Grid): void {
1491+
private drawDebugGrid(grid: Grid, debugCellHeight: number): void {
14881492
for (let row = 0; row < grid.cellsY; row++) {
14891493
for (let col = 0; col < grid.cellsX; col++) {
14901494
if (!grid.getCell(col, row)) {
@@ -1496,7 +1500,7 @@ export class GameScene extends Phaser.Scene {
14961500
x: grid.absoluteLeft + col * grid.cellWidth,
14971501
y: grid.absoluteTop + row * grid.cellHeight,
14981502
w: grid.cellWidth,
1499-
h: grid.cellHeight,
1503+
h: debugCellHeight,
15001504
},
15011505
DEBUG_HITBOX_COLOR,
15021506
);

0 commit comments

Comments
 (0)