tilemap no longer uses ppu

This commit is contained in:
2025-10-09 03:32:08 -05:00
parent 5b2a88d520
commit 923b5bc3d6

View File

@@ -5,10 +5,11 @@ function tilemap()
this.tiles = [];
this.offset_x = 0;
this.offset_y = 0;
this.ppu = 32
this.layer = 0; // Default layer for scene tree sorting
this._geometry_cache = {}; // Cache actual geometry data by texture
this._dirty = true;
this.scale_x = 1
this.scale_y = 1
return this;
}
@@ -110,17 +111,13 @@ tilemap.prototype =
var textureKey = imageToKey.get(tile);
if (!textureGroups[textureKey]) {
// compute world-unit size of one tile of this texture
var tile_wu = tile.width / this.ppu;
var tile_hu = tile.height / this.ppu;
textureGroups[textureKey] = {
tiles: [],
image: tile, // Store the image object
offset_x: this.offset_x,
offset_y: this.offset_y,
size_x: tile_wu,
size_y: tile_hu
size_x: this.scale_x,
size_y: this.scale_y
};
}
textureGroups[textureKey].tiles.push({