diff --git a/prosperon/sound.cm b/prosperon/sound.cm index 63b5c85c..0b40b138 100644 --- a/prosperon/sound.cm +++ b/prosperon/sound.cm @@ -92,6 +92,6 @@ function pump() { $_.delay(pump, 1/240) } -pump() +//pump() return audio diff --git a/prosperon/tilemap.cm b/prosperon/tilemap.cm index b935a256..457a3a09 100644 --- a/prosperon/tilemap.cm +++ b/prosperon/tilemap.cm @@ -66,19 +66,28 @@ tilemap.prototype = // Ensure array exists up to x while (this.tiles.length <= x) this.tiles.push([]); - // Convert string to image object if needed + // Convert string to image object if needed, or handle null to remove tile if (image && typeof image == 'string') { var graphics = use('graphics'); image = graphics.texture(image); } + // Note: if image is null, it will remove the tile - // Set the value + // Set the value (null removes the tile) this.tiles[x][y] = image; // Mark cache as dirty when tiles change this._dirty = true; }, + clear() { + this.tiles = []; + this.offset_x = 0; + this.offset_y = 0; + this._geometry_cache = {}; + this._dirty = true; + }, + // Build cached geometry grouped by texture _build_geometry_cache(pos = {x: 0, y: 0}) { var geometry = use('geometry');