Fix map stuff, and implement builtin funcs for it
This commit is contained in:
@@ -32,14 +32,14 @@ const state = {
|
||||
setInPatch(i: number, sprsheet: number, sprite: number) {
|
||||
const xx = this.selectedPatch%overviewW;
|
||||
const yy = Math.floor(this.selectedPatch/overviewW);
|
||||
const cell = (yy+patchH*Math.floor(i/patchW))*overviewW*patchW+xx*patchW+i%patchW;
|
||||
const cell = (yy*patchH+Math.floor(i/patchW))*overviewW*patchW+xx*patchW+i%patchW;
|
||||
this.map[cell] = [sprsheet, sprite];
|
||||
},
|
||||
get patch() {
|
||||
const xx = this.selectedPatch%overviewW;
|
||||
const yy = Math.floor(this.selectedPatch/overviewW);
|
||||
return Array(overviewH).fill(0).flatMap((_, i) => {
|
||||
const start = (yy+patchH*i)*overviewW*patchW+xx*patchW;
|
||||
const start = (yy*patchH+i)*overviewW*patchW+xx*patchW;
|
||||
return this.map.slice(start, start+patchW);
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user