← Asian3D assetfogon/pagoda
Pagoda de cinco pisos
Drag to turn it// «Pagoda de cinco pisos» · gpt-6-sol (medium)
// A five-tiered pagoda: square stone base with steps, five stacked floors getting smaller, each with red wooden columns and a wide roof of dark green tiles with upturned corners, a golden spire on top.
const C = {
stone: ["#e8e1d0", "#d5cbb9", "#b9ae9d"],
red: "#a92422",
redLight: "#ca3b2e",
redDark: "#681d1d",
wood: "#422626",
gold: "#e9ba53",
goldLight: "#ffe091",
window: "#173d39",
lattice: "#b88747",
roof: ["#164b40", "#1b5949", "#246754", "#30705b"],
roofDark: "#13372f"
};
const CX = 24, CY = 24;
// Raised stone foundation and broad front steps.
for (let z = 0; z <= 3; z++) {
const r = 17 - z;
box(CX-r, CY-r, z, CX+r, CY+r, z,
C.stone[Math.min(2, Math.floor(z / 2))]);
for (let x = CX-r; x <= CX+r; x += 3) {
set(x, CY-r, z, C.stone[0]);
}
}
for (let z = 0; z <= 2; z++) {
box(18+z, 3+z, z, 30-z, 9, z, C.stone[z === 0 ? 2 : 0]);
}
// Each storey has a dark recessed wall, lacquered posts, and gold-framed windows.
const tiers = [
{r: 20, room: 13, floor: 3, eave: 10},
{r: 17, room: 11, floor: 13, eave: 17},
{r: 14, room: 9, floor: 20, eave: 24},
{r: 11, room: 7, floor: 27, eave: 31},
{r: 8, room: 5, floor: 34, eave: 38}
];
function storey(t) {
const r = t.room, bottom = t.floor + 1, top = t.eave - 1;
box(CX-r-1, CY-r-1, t.floor, CX+r+1, CY+r+1, t.floor, C.redDark);
box(CX-r, CY-r, bottom, CX+r, CY+r, top, C.wood);
// Windows on all four faces, with a strong, readable front elevation.
for (const side of [-1, 1]) {
for (let q = -r+3; q <= r-3; q++) {
const framed = q % 4 === 0;
for (let z = bottom+1; z <= top-1; z++) {
const shade = framed ? C.lattice : C.window;
set(CX+q, CY+side*r, z, shade);
set(CX+side*r, CY+q, z, shade);
}
}
}
// Paired front and rear posts, echoed on the sides.
const posts = [-r+1, -Math.floor(r/3), Math.floor(r/3), r-1];
for (const p of posts) {
for (const side of [-1, 1]) {
box(CX+p, CY+side*(r+1), bottom, CX+p+1, CY+side*(r+1), top, C.red);
box(CX+side*(r+1), CY+p, bottom, CX+side*(r+1), CY+p+1, top, C.red);
set(CX+p, CY+side*(r+1), top, C.gold);
set(CX+side*(r+1), CY+p, top, C.gold);
}
}
// Vermilion lintels and fine gilt bands beneath the eaves.
for (const side of [-1, 1]) {
box(CX-r-1, CY+side*(r+1), top, CX+r+1, CY+side*(r+1), top, C.redLight);
box(CX+side*(r+1), CY-r-1, top, CX+side*(r+1), CY+r+1, top, C.redLight);
box(CX-r-1, CY+side*(r+1), bottom, CX+r+1, CY+side*(r+1), bottom, C.gold);
}
}
function roof(t) {
const r = t.r, e = t.eave;
for (let dx = -r; dx <= r; dx++) {
for (let dy = -r; dy <= r; dy++) {
const ax = Math.abs(dx), ay = Math.abs(dy);
const edge = Math.max(ax, ay);
const slope = Math.min(3, Math.floor((r-edge)/3));
const corner = Math.max(0, Math.min(ax, ay) - (r-3));
const z = e + slope + corner;
set(CX+dx, CY+dy, z-1, C.roofDark);
let tile = C.roof[(Math.floor((dx+100)/3) + Math.floor((dy+100)/4)) % 4];
if (rand() < 0.075) tile = C.roof[2];
set(CX+dx, CY+dy, z, tile);
// Gilded edge visible below the projecting green tiles.
if (edge === r) set(CX+dx, CY+dy, z-1, C.gold);
}
}
// Curled, gold-tipped corners.
for (const sx of [-1, 1]) for (const sy of [-1, 1]) {
const x = CX+sx*r, y = CY+sy*r;
set(x, y, e+3, C.gold);
set(x, y, e+4, C.goldLight);
}
// Small raised ridge cap.
for (let x = CX-2; x <= CX+2; x++)
set(x, CY, e+4, C.roofDark);
set(CX, CY, e+4, C.gold);
}
for (const tier of tiers) {
storey(tier);
roof(tier);
}
// Golden finial rising from the fifth roof.
box(23, 23, 42, 25, 25, 42, C.gold);
box(24, 24, 43, 24, 24, 45, C.goldLight);
for (const z of [43, 45]) {
box(23, 24, z, 25, 24, z, C.gold);
box(24, 23, z, 24, 25, z, C.gold);
}import { draw } from "./assets/voxel";
import { pagoda } from "./assets/pagoda";
// Every frame: standing on (x, y), the centre of its base.
draw(ctx, pagoda, x, y, { size: 64, angle: 0, t: performance.now() / 1000 });
// size: its longest side, in px
// angle: turn on the floor, in radians
// t: seconds; if it moves, that animates it# In a terminal, in the game's folder
fogon assets add pagoda
# With Fogón's tools (connector)
add_assets({ slug: "<your-game>", ids: ["pagoda"] })
# It lands in client/assets/pagoda.ts
# https://fogon.page/object/pagoda