Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/playground/blocks/block_judgement.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
11 changes: 11 additions & 0 deletions src/playground/blocks/block_moving.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { GEHelper } from '../../graphicEngine/GEHelper';

module.exports = {
getBlocks() {
function moveInToBound(object, wall) {
Expand Down Expand Up @@ -110,6 +112,15 @@ module.exports = {
class: 'walk',
isNotFor: [],
func(sprite, script) {
// 내용이 빈 글상자는 캔버스 렌더러에서 bounds가 null이라
// 벽 충돌을 계산할 수 없으므로 튕기지 않고 넘어간다.
if (
sprite.type === 'textBox' &&
!GEHelper.getTransformedBounds(sprite.object)
) {
sprite.collision = Entry.Utils.COLLISION.NONE;
return script.callReturn();
}
const threshold = 0;
const method = sprite.parent.getRotateMethod();

Expand Down
4 changes: 4 additions & 0 deletions src/util/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ||
Expand Down