Tilorswift json loader implemented.

This commit is contained in:
Mal
2020-01-29 00:21:53 +01:00
parent 6cf50f75e1
commit b989604a0e
8 changed files with 181 additions and 11 deletions

29
tilorswift/js/Tileset.js Normal file
View File

@@ -0,0 +1,29 @@
export default class Tileset
{
constructor(image, tiles, scale = 1)
{
this.image = image;
this.tiles = tiles;
this.scale = scale;
}
getWidth()
{
return this.image.width * this.scale;
}
getHeight()
{
return this.image.height * this.scale;
}
getTileWidth()
{
return this.image.width / this.tiles * this.scale;
}
getTileHeight()
{
return this.image.height * this.scale;
}
}