From aa3007761fc264f0f1894b38e6d65ffe6a6208fc Mon Sep 17 00:00:00 2001 From: YOUNGHO LEE Date: Thu, 2 Jul 2026 22:52:42 +0900 Subject: [PATCH 1/2] fix: prevent TypeError when collision blocks run on an empty textbox --- src/playground/blocks/block_judgement.js | 5 +++++ src/playground/blocks/block_moving.js | 10 ++++++++++ src/util/utils.js | 4 ++++ 3 files changed, 19 insertions(+) diff --git a/src/playground/blocks/block_judgement.js b/src/playground/blocks/block_judgement.js index 853683dea2..dd7b5ca1b2 100644 --- a/src/playground/blocks/block_judgement.js +++ b/src/playground/blocks/block_judgement.js @@ -167,6 +167,11 @@ module.exports = { const reg = /wall/; const ath = 0.2; const object = sprite.object; + // 내용이 빈 글상자는 캔버스 렌더러에서 bounds가 null이라 + // 충돌을 판정할 수 없으므로 닿지 않은 것으로 처리한다. + if (sprite.type === 'textBox' && !GEHelper.getTransformedBounds(object)) { + return false; + } const isWall = reg.test(targetSpriteId); const collision = ndgmr.checkPixelCollision; if (isWall) { diff --git a/src/playground/blocks/block_moving.js b/src/playground/blocks/block_moving.js index 9cf1705251..8a165fd432 100644 --- a/src/playground/blocks/block_moving.js +++ b/src/playground/blocks/block_moving.js @@ -1,3 +1,5 @@ +import { GEHelper } from '../../graphicEngine/GEHelper'; + module.exports = { getBlocks() { function moveInToBound(object, wall) { @@ -110,6 +112,14 @@ module.exports = { class: 'walk', isNotFor: [], func(sprite, script) { + // 내용이 빈 글상자는 캔버스 렌더러에서 bounds가 null이라 + // 벽 충돌을 계산할 수 없으므로 튕기지 않고 넘어간다. + if ( + sprite.type === 'textBox' && + !GEHelper.getTransformedBounds(sprite.object) + ) { + return script.callReturn(); + } const threshold = 0; const method = sprite.parent.getRotateMethod(); diff --git a/src/util/utils.js b/src/util/utils.js index b2e6176d62..dea8347846 100644 --- a/src/util/utils.js +++ b/src/util/utils.js @@ -1345,6 +1345,10 @@ Entry.getKeyCodeMap = function () { }; Entry.checkCollisionRect = function (rectA, rectB) { + // 내용이 빈 글상자처럼 bounds를 구할 수 없는(null) 대상은 충돌하지 않은 것으로 처리한다. + if (!rectA || !rectB) { + return false; + } return !( rectA.y + rectA.height < rectB.y || rectA.y > rectB.y + rectB.height || From d396cda636bd088dd7feaf31e3e8511a668ba7fa Mon Sep 17 00:00:00 2001 From: YOUNGHO LEE Date: Fri, 3 Jul 2026 17:12:13 +0900 Subject: [PATCH 2/2] fix: reset textbox wall collision state when bounds are missing --- src/playground/blocks/block_moving.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/playground/blocks/block_moving.js b/src/playground/blocks/block_moving.js index 8a165fd432..55db1c5092 100644 --- a/src/playground/blocks/block_moving.js +++ b/src/playground/blocks/block_moving.js @@ -118,6 +118,7 @@ module.exports = { sprite.type === 'textBox' && !GEHelper.getTransformedBounds(sprite.object) ) { + sprite.collision = Entry.Utils.COLLISION.NONE; return script.callReturn(); } const threshold = 0;