diff --git a/graphic-sets.json b/graphic-sets.json index 18ca004..24859a5 100644 --- a/graphic-sets.json +++ b/graphic-sets.json @@ -12,5 +12,12 @@ "tiles": 2, "backgroundColor": "#000000", "backgroundImage": "background_earth.jpg" + }, + { + "name": "Io", + "tileset": "io.jpg", + "tiles": 3, + "backgroundColor": "#000000", + "backgroundImage": "background_jupiter.jpg" } ] diff --git a/graphics/background_jupiter.jpg b/graphics/background_jupiter.jpg new file mode 100644 index 0000000..3ad46ea Binary files /dev/null and b/graphics/background_jupiter.jpg differ diff --git a/graphics/tileset/io.jpg b/graphics/tileset/io.jpg new file mode 100644 index 0000000..b189cc7 Binary files /dev/null and b/graphics/tileset/io.jpg differ diff --git a/js/GraphicSet.js b/js/GraphicSet.js index 39e3f1b..4f2f732 100644 --- a/js/GraphicSet.js +++ b/js/GraphicSet.js @@ -42,6 +42,17 @@ let GraphicSet = [ tilePreview: 46, primaryTiles: 3, gravity: 2, + }, + { + name: 'Io', + tileset: 'io.png', + tiles: 96, + scale: 1, + backgroundColor: '#000000', + backgroundImage: 'background_jupiter.jpg', + tilePreview: 2, + primaryTiles: 6, + gravity: 0.5, } ]; diff --git a/tilorswift/js/Terrain.js b/tilorswift/js/Terrain.js index 3ee6ee5..1fea5fa 100644 --- a/tilorswift/js/Terrain.js +++ b/tilorswift/js/Terrain.js @@ -53,12 +53,12 @@ export default class Terrain getWidth() { - return this.tilesX * this.tilest.getTileWidth(); + return this.tilesX * this.tileset.getTileWidth(); } getHeight() { - return this.tilesY * this.tilest.getTileHeight(); + return this.tilesY * this.tileset.getTileHeight(); } addRows(index, quantity = 1) @@ -70,6 +70,14 @@ export default class Terrain this.targetTileY = this.targetTileY === undefined ? undefined : this.targetTileY + 1; } + for (let y = index; y < this.tilesY; y++) { + for (let x = 0; x < this.tilesX; x++) { + // this.fields[y][x].index += quantity; + console.log(x, y); + this.fields[y][x].y += quantity; + } + } + this.htmlElement.style.height = this.tileset.getTileHeight() * this.tilesY + 'px'; } @@ -98,6 +106,8 @@ export default class Terrain addColumns(index, quantity = 1) { + console.log(this.fields); + for (let c = 0; c < quantity; c++) { this._insertColumn(index); this.tilesX++; @@ -105,7 +115,15 @@ export default class Terrain this.targetTileX = this.targetTileX === undefined ? undefined : this.targetTileX + 1; } + for (let y = 0; y < this.tilesY; y++) { + for (let x = index; x < this.tilesX; x++) { + this.fields[y][x].x += quantity; + } + } + this.htmlElement.style.width = this.tileset.getTileWidth() * this.tilesX + 'px'; + + console.log(this.fields); } _insertColumn(index = undefined) @@ -233,6 +251,8 @@ export default class Terrain return true; } + console.log(x, y); + return this.fields[y][x].index > -1; }