← AsiáticoObjeto 3Dfogon/puerta-de-luna
Puerta de la luna
Arrastrá para girarlo// «Puerta de la luna» · gpt-6-sol (medium)
// A garden moon gate: a white plastered wall with a large perfectly round opening, grey roof tiles along the top of the wall, stepping stones passing through the circle and a few bamboo stalks beside it.
const white = ["#f6f1df", "#eee8d7", "#e3dccb"];
const jade = ["#244e43", "#326354", "#3d7461", "#4c866c"];
const red = "#893c32";
const gold = "#d5ad63";
const cx = 24, cz = 15;
const opening = 15.2;
// Plastered wall, with a circular opening cut all the way through.
for (let x = 6; x <= 42; x++)
for (let y = 20; y <= 28; y++)
for (let z = 0; z <= 33; z++) {
const d = Math.hypot(x - cx, z - cz);
if (d <= opening) continue;
let color = white[z > 23 ? 0 : z < 4 ? 2 : 1];
if (rand() < 0.075) color = white[Math.floor(rand() * 3)];
if (d < 16.4) color = y === 20 || y === 28 ? red : "#aa6250";
set(x, y, z, color);
}
// Red lacquer and a fine gold outline on the visible face of the arch.
for (let x = 6; x <= 42; x++)
for (let z = 0; z <= 33; z++) {
const d = Math.hypot(x - cx, z - cz);
if (d > opening && d < 16.5) set(x, 19, z, red);
else if (d >= 16.5 && d < 17.15) set(x, 19, z, gold);
}
// Stone base and lacquered corner posts. Keep the threshold open.
for (const x of [6, 7, 41, 42]) {
box(x, 18, 1, x, 20, 32, red);
box(x, 18, 3, x, 18, 3, gold);
box(x, 18, 30, x, 18, 30, gold);
}
for (let x = 5; x <= 43; x++)
for (let y = 19; y <= 29; y++)
for (let z = 0; z <= 2; z++)
if (Math.hypot(x - cx, z - cz) > opening)
set(x, y, z, z === 0 ? "#999a91" : "#c1beb0");
// Beam beneath the roof.
box(5, 18, 33, 43, 30, 34, "#783d35");
box(5, 17, 33, 43, 17, 33, gold);
box(5, 31, 33, 43, 31, 33, gold);
// Sweeping glazed roof: raised ridge, tiled slopes, upturned ends.
for (let x = 3; x <= 45; x++)
for (let y = 16; y <= 32; y++) {
const slope = Math.abs(y - 24);
let z = 40 - Math.ceil(slope * 0.53);
if (x <= 5 || x >= 43) z += 2;
const tile = jade[(Math.floor(x / 3) + Math.floor(y / 3)) % jade.length];
set(x, y, z - 1, "#203e38");
set(x, y, z, tile);
if (x % 3 === 0) set(x, y, z + 1, "#60947a");
if (y === 16 || y === 32) set(x, y, z - 1, "#173c36");
}
box(6, 23, 41, 42, 25, 41, "#214b40");
for (let x = 7; x <= 41; x += 3)
box(x, 24, 42, x + 1, 24, 42, "#729b7b");
// Irregular stepping stones run from the foreground through the moon gate.
const steps = [
[23, 4], [25, 9], [23, 14], [24, 19],
[24, 23], [24, 27], [24, 32], [25, 37], [23, 42]
];
for (const [sx, sy] of steps) {
for (let x = sx - 3; x <= sx + 3; x++)
for (let y = sy - 2; y <= sy + 2; y++) {
const shape = ((x - sx) / 2.8) ** 2 + ((y - sy) / 2.15) ** 2;
if (shape < 1 && rand() > 0.055) {
set(x, y, 0, rand() < 0.3 ? "#a7aaa0" : "#c6c6b8");
if (shape < 0.48 && rand() > 0.22)
set(x, y, 1, rand() < 0.25 ? "#e0dac9" : "#bcbdb2");
}
}
}
// Bamboo growing beside the gate.
function bamboo(x, y, height) {
for (let z = 0; z <= height; z++) {
set(x, y, z, z % 5 === 0 ? "#b9ad69" : z % 3 === 0 ? "#639257" : "#477d4c");
if (z % 5 === 0) set(x + 1, y, z, "#a5ae68");
}
for (const z of [9, 14, 19, height - 2]) {
for (const side of [-1, 1]) {
line(x, y, z, x + side * 3, y - 1, z + 2, 0, "#527b4b");
line(x + side * 2, y - 1, z + 2,
x + side * 4, y - 2, z + 1, 0, "#659359");
line(x + side * 2, y, z + 2,
x + side * 3, y + 1, z + 4, 0, "#79a46a");
}
}
}
bamboo(7, 12, 25);
bamboo(10, 15, 21);
bamboo(41, 12, 27);
bamboo(38, 15, 20);
// Low garden greenery and scattered cherry-pink blossoms.
for (const [x, y] of [[13, 14], [14, 9], [35, 12], [36, 6], [8, 34], [40, 36]]) {
ellipsoid(x, y, 1, 3, 2, 1, "#386b4b");
for (let i = 0; i < 5; i++) {
const px = x + Math.floor(rand() * 5) - 2;
const py = y + Math.floor(rand() * 3) - 1;
set(px, py, 2, rand() < 0.5 ? "#e6a9ad" : "#f3c3bf");
}
}import { draw } from "./assets/voxel";
import { puertaDeLuna } from "./assets/puerta-de-luna";
// En cada cuadro: parado sobre (x, y), el centro de su base.
draw(ctx, puertaDeLuna, x, y, { size: 64, angle: 0, t: performance.now() / 1000 });
// size: lo que mide en px su lado más largo
// angle: giro sobre el piso, en radianes
// t: segundos; si se mueve, se anima solo con eso# En una terminal, en la carpeta del juego
fogon assets add puerta-de-luna
# Con las herramientas de Fogón (conector)
add_assets({ slug: "<tu-juego>", ids: ["puerta-de-luna"] })
# Queda en client/assets/puerta-de-luna.ts
# https://fogon.page/object/puerta-de-luna