-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor isometric grid rendering Fix isometric level demo Improve isometric level support and add more demo examples Lint addIsometricLevel: Mirror width and height property names from addLevel Remove unnecessary from2dTo1dIndex method of isometricLevel Rename and lint isometricLevel interface to match levels
- Loading branch information
1 parent
9c4c3f3
commit dcba23c
Showing
5 changed files
with
258 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// Build levels with addIsometricLevel() | ||
|
||
// Start game | ||
kaboom() | ||
|
||
// Load assets | ||
loadSprite("grass", "/sprites/iso_grass.png") | ||
loadSprite("darker_grass", "/sprites/iso_grass_darker.png") | ||
|
||
gravity(0) | ||
camScale(0.33) | ||
camPos(vec2(100, 1000)) | ||
|
||
addIsometricLevel([ | ||
// Design the isometric level layout with symbols | ||
// 15x15 grid in this case so we have a perfect tiled square diamond shaped map | ||
"@@@@@@@@@@@@@@@", | ||
"@@@@@@@@@@@@@@@", | ||
"@@@@@@@@@@@@@@@", | ||
"@@@@!@@@@!@@@@@", | ||
"@@@@@@@@@@@@@@@", | ||
"@@@@@@@@@@@@@@@", | ||
"@@@@@!@@@!@@@@@", | ||
"@@@@@@!!!@@@@@@", | ||
"@@@@@@@@@@@@@@@", | ||
"@@@@@@@@@@@@@@@", | ||
"@@@@@@@@@@@@@@@", | ||
"@@@@@@@@@@@@@@@", | ||
"@@@@@@@@@@@@@@@", | ||
"@@@@@@@@@@@@@@@", | ||
"@@@@@@@@@@@@@@@", | ||
], { | ||
// The size of each grid | ||
width: 144, | ||
height: 71, | ||
// Define what each symbol means (in components) | ||
"@": () => [ | ||
sprite("grass"), | ||
], | ||
"!": () => [ | ||
sprite("darker_grass"), | ||
], | ||
}) | ||
|
||
addIsometricLevel([ | ||
// 15x9 grid | ||
"@@@@@@@@@@@@@@@", | ||
"@@@@@@@@@@@@@@@", | ||
"@@@@@@@!@@@@@@@", | ||
"@@@@@@@!@@@@@@@", | ||
"@@@@@@@!@@@@@@@", | ||
"@@@@@@@!@@@@@@@", | ||
"@@@@@@@!@@@@@@@", | ||
"@@@@@@@@@@@@@@@", | ||
"@@@@@@@!@@@@@@@", | ||
"@@@@@@@@@@@@@@@", | ||
"@@@@@@@@@@@@@@@", | ||
], { | ||
width: 144, | ||
height: 71, | ||
"@": () => [ | ||
sprite("grass"), | ||
], | ||
"!": () => [ | ||
sprite("darker_grass"), | ||
], | ||
// The position of the top left block | ||
pos: vec2(0, 1200), | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters