Fix offsetting

This commit is contained in:
Evert Prants 2018-08-19 18:49:45 +03:00
parent 29205d9298
commit 68c046a953
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
2 changed files with 3 additions and 3 deletions

2
dist/dwelibs.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -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)
} }