Menu bar for brush selection implemented.

This commit is contained in:
Mal
2020-01-30 23:40:42 +01:00
parent 2fa3bf5a53
commit 9c3aca1bc9
10 changed files with 142 additions and 23 deletions

View File

@@ -1,5 +1,6 @@
import Field from "./Field.js";
import Tileset from "./Tileset.js";
import TilorswiftEvent from "./events/TilorswiftEvent.js";
export default class Terrain
{
@@ -37,6 +38,13 @@ export default class Terrain
this.fields.push(row);
this.htmlElement.appendChild(tr);
}
window.addEventListener(
TilorswiftEvent.BUTTON_TILE_CLICKED,
(event) => {
this.brushTileIndex = event.button.index;
}
)
}
getElement()
@@ -44,6 +52,11 @@ export default class Terrain
return this.htmlElement;
}
getTileset()
{
return this.tileset;
}
setFieldIndex(x, y, index)
{
this.fields[y][x].setIndex(index);