Skip to content
This repository was archived by the owner on Nov 12, 2024. It is now read-only.

Commit 9ae7145

Browse files
committed
Fix isometric level demo
1 parent 27024e9 commit 9ae7145

2 files changed

Lines changed: 17 additions & 14 deletions

File tree

demo/isometricLevel.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@ kaboom()
77
loadSprite('grass', '/sprites/iso_grass.png')
88

99
gravity(0)
10-
camScale(0.2)
11-
camPos(-400, 200)
10+
camScale(0.4)
11+
camPos(vec2(0, 400))
1212

1313
const GRID_LENGTH = 15
1414

1515
const level = addIsometricLevel([
1616
// Design the level layout with symbols
17-
...Array.from({ length: GRID_LENGTH }).map(() => Array.from({ length: GRID_LENGTH }).map(() => '@').join(''))
17+
...Array.from({ length: GRID_LENGTH }).map(() =>
18+
Array.from({ length: GRID_LENGTH }).map(() => '@').join('')
19+
)
1820
], {
1921
// The size of each grid
2022
tileWidth: 144,

src/kaboom.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2551,20 +2551,21 @@ function addIsometricLevel(map: string[], options: IsometricLevelOpt): Isometric
25512551
return;
25522552
}
25532553

2554-
// const posComp = vec2(
2555-
// offset.x + position.x * options.tileWidth,
2556-
// offset.y + position.y * options.tileHeight
2557-
// );
2554+
const posComp = vec2(
2555+
offset.x + position.x * options.tileWidth,
2556+
offset.y + position.y * options.tileHeight
2557+
);
25582558

2559-
// for (const comp of comps) {
2560-
// if (comp.id === "pos") {
2561-
// posComp.x += comp.pos.x;
2562-
// posComp.y += comp.pos.y;
2559+
for (const comp of comps) {
2560+
if (comp.id === "pos") {
2561+
posComp.x += comp.pos.x;
2562+
posComp.y += comp.pos.y;
25632563

2564-
// break;
2565-
// }
2566-
// }
2564+
break;
2565+
}
2566+
}
25672567

2568+
comps.push(origin(vec2(0.5, 0.5)));
25682569
comps.push(pos(position));
25692570
comps.push(isometricGrid(this, position));
25702571

0 commit comments

Comments
 (0)