Published
Edited
Aug 25, 2021
Insert cell
Insert cell
Insert cell
Insert cell
bg = (await import('https://cdn.skypack.dev/better-dungeons@5.1.0?min')).default
Insert cell
PIXI = import ("https://cdn.skypack.dev/pixi.js");

Insert cell
view = html`<div></div>`
Insert cell
bg(100, 100, 0.3, 5, 5, Date.now().toString())
Insert cell
{
var app = new PIXI.Application(100 * 10, 100 * 10);
view.appendChild(app.view)
bg(100, 100, 1 / 3, 5, 5, Date.now().toString()).then(dungeon => {
var graphics = new PIXI.Graphics();
for (var row = 0; row < dungeon.gridLength; row++) {
for (var column = 0; column < dungeon.gridWidth; column++) {
if (dungeon.grid[row][column] == 1) {
graphics.beginFill(0x2f4f4f, 1);
graphics.drawRect(column * 10, row * 10, 10, 10);
}
if (dungeon.grid[row][column] != 1) {
graphics.beginFill(0xd3d3d3, 1);
graphics.drawRect(column * 10, row * 10, 10, 10);
}
}
}
app.stage.addChild(graphics);
})
.catch(err => {
console.log("Something went wrong :(");
});
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more