Io graphics set added

This commit is contained in:
Mal 2024-08-01 15:32:53 +02:00
parent 3d4235766d
commit 558cc6119c
5 changed files with 40 additions and 2 deletions

View File

@ -12,5 +12,12 @@
"tiles": 2, "tiles": 2,
"backgroundColor": "#000000", "backgroundColor": "#000000",
"backgroundImage": "background_earth.jpg" "backgroundImage": "background_earth.jpg"
},
{
"name": "Io",
"tileset": "io.jpg",
"tiles": 3,
"backgroundColor": "#000000",
"backgroundImage": "background_jupiter.jpg"
} }
] ]

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

BIN
graphics/tileset/io.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

View File

@ -42,6 +42,17 @@ let GraphicSet = [
tilePreview: 46, tilePreview: 46,
primaryTiles: 3, primaryTiles: 3,
gravity: 2, gravity: 2,
},
{
name: 'Io',
tileset: 'io.png',
tiles: 96,
scale: 1,
backgroundColor: '#000000',
backgroundImage: 'background_jupiter.jpg',
tilePreview: 2,
primaryTiles: 6,
gravity: 0.5,
} }
]; ];

View File

@ -53,12 +53,12 @@ export default class Terrain
getWidth() getWidth()
{ {
return this.tilesX * this.tilest.getTileWidth(); return this.tilesX * this.tileset.getTileWidth();
} }
getHeight() getHeight()
{ {
return this.tilesY * this.tilest.getTileHeight(); return this.tilesY * this.tileset.getTileHeight();
} }
addRows(index, quantity = 1) addRows(index, quantity = 1)
@ -70,6 +70,14 @@ export default class Terrain
this.targetTileY = this.targetTileY === undefined ? undefined : this.targetTileY + 1; 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'; this.htmlElement.style.height = this.tileset.getTileHeight() * this.tilesY + 'px';
} }
@ -98,6 +106,8 @@ export default class Terrain
addColumns(index, quantity = 1) addColumns(index, quantity = 1)
{ {
console.log(this.fields);
for (let c = 0; c < quantity; c++) { for (let c = 0; c < quantity; c++) {
this._insertColumn(index); this._insertColumn(index);
this.tilesX++; this.tilesX++;
@ -105,7 +115,15 @@ export default class Terrain
this.targetTileX = this.targetTileX === undefined ? undefined : this.targetTileX + 1; 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'; this.htmlElement.style.width = this.tileset.getTileWidth() * this.tilesX + 'px';
console.log(this.fields);
} }
_insertColumn(index = undefined) _insertColumn(index = undefined)
@ -233,6 +251,8 @@ export default class Terrain
return true; return true;
} }
console.log(x, y);
return this.fields[y][x].index > -1; return this.fields[y][x].index > -1;
} }