Click'a-di-click

You can place walls using the mouse (or any other pointer device).

 

This example overloads the MatrixCanvas.onPointerDown() method, to set objects on pointer interaction.

class PointerControl extends MatrixCanvas {
    /**
     * Set a Wall object to the selected tile.
     * @param {Point} pointer
     */
    onPointerDown(pointer) {
        super.onPointerDown(pointer);

        if(!this.matrix.hasValue(this.lastClickedTile, Cursor)
            && !this.actions.paused) {
            this.matrix.setValue(
                this.lastClickedTile,
                new Wall()
            );
        }
    }
}

new PointerControl("#my-canvas");