Last active
February 12, 2022 19:27
-
-
Save stmn/b5f782acad691964065c0a9efaeb3ce0 to your computer and use it in GitHub Desktop.
k.z() problem
This file contains hidden or 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
import kaboom from "kaboom"; | |
const k = kaboom({ | |
canvas: document.getElementById('canvas'), | |
}) | |
k.loadSpriteAtlas("./assets/sprites/Tileset.png", { | |
'traps': { | |
x: 0, | |
y: 0, | |
width: 32, | |
height: 32, | |
sliceX: 1, | |
sliceY: 1 | |
}, | |
}) | |
k.loadSpriteAtlas('./assets/sprites/Tileset.png', { | |
'grass': { | |
x: 0, | |
y: 0, | |
width: 32, | |
height: 32, | |
sliceX: 1, | |
sliceY: 1, | |
} | |
}) | |
k.scene('main', () => { | |
const map = [ | |
"===========================", | |
"===========================", | |
"== ==", | |
"== ==", | |
"== ==", | |
"== == == ==", | |
"== == ==LLLLL== == ==", | |
"== ========= ==", | |
"== ========= ==", | |
"== == == ==", | |
"== =LL== ==LL= ==", | |
"== ===== @ ===== ==", | |
"== = ==", | |
"== ==", | |
"==LLLLL==LLLLLLLLL==LLLLL==", | |
"===========================", | |
"===========================", | |
]; | |
// low fps | |
k.addLevel(map, { | |
width: 32, | |
height: 32, | |
"=": () => [ | |
k.sprite("grass"), | |
k.z(11), | |
], | |
"L": () => [ | |
k.sprite("traps"), | |
k.z(11), | |
], | |
}) | |
// high fps | |
// k.addLevel(map, { | |
// width: 32, | |
// height: 32, | |
// "=": () => [ | |
// k.sprite("grass"), | |
// k.z(10), | |
// ], | |
// "L": () => [ | |
// k.sprite("traps"), | |
// k.z(9), | |
// ], | |
// }) | |
} | |
) | |
k.go('main') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment