Fix offsetting
This commit is contained in:
parent
29205d9298
commit
68c046a953
2
dist/dwelibs.min.js
vendored
2
dist/dwelibs.min.js
vendored
File diff suppressed because one or more lines are too long
@ -57,7 +57,7 @@ DWE.Tiled.Map = class {
|
|||||||
|
|
||||||
for(let i = 0; i < lw; i++) {
|
for(let i = 0; i < lw; i++) {
|
||||||
for(let j = 0; j < lh; j++) {
|
for(let j = 0; j < lh; j++) {
|
||||||
let value = layer.data[(j * width) + i]
|
let value = layer.data[(j * lw) + i]
|
||||||
if (value == 0) continue
|
if (value == 0) continue
|
||||||
|
|
||||||
tiles.push({
|
tiles.push({
|
||||||
@ -136,7 +136,7 @@ DWE.Tiled.Map = class {
|
|||||||
let tcount = tileMap.tileCount || tileMap.tiles.length
|
let tcount = tileMap.tileCount || tileMap.tiles.length
|
||||||
|
|
||||||
if (tile.tile >= tileMap.offset && tile.tile <= tcount) {
|
if (tile.tile >= tileMap.offset && tile.tile <= tcount) {
|
||||||
tileMap.draw(ctx, tile.tile - 1, ((tile.x * this.tileWidth * this.scale) + origin.x + layer.x) + viewport.x,
|
tileMap.draw(ctx, tile.tile - tileMap.offset, ((tile.x * this.tileWidth * this.scale) + origin.x + layer.x) + viewport.x,
|
||||||
((tile.y * this.tileHeight * this.scale) + origin.y + layer.y) + viewport.y, this.tileWidth * this.scale,
|
((tile.y * this.tileHeight * this.scale) + origin.y + layer.y) + viewport.y, this.tileWidth * this.scale,
|
||||||
this.tileHeight * this.scale)
|
this.tileHeight * this.scale)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user