mr-crocs-adventures/tilorswift/js/Tileset.js

29 lines
490 B
JavaScript
Raw Normal View History

2020-01-29 00:21:53 +01:00
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;
}
}