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

34 lines
729 B
JavaScript
Raw Normal View History

import GraphicSet from "../../js/GraphicSet.js";
import Setting from "../../js/Setting.js";
2020-01-29 00:21:53 +01:00
export default class Tileset
{
constructor(setId)
2020-01-29 00:21:53 +01:00
{
this.setId = setId;
this.image = new Image();
this.image.src = Setting.TILESET_LOCATION + GraphicSet[this.setId].tileset;
this.tiles = GraphicSet[this.setId].tiles;
this.scale = GraphicSet[this.setId].scale;
2020-01-29 00:21:53 +01:00
}
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;
}
}