← BásicoObjeto 3Dfogon/farola
Farola
Arrastrá para girarlo// «Farola» · gpt-6-sol (medium)
// Street lamp («Farola»).
const stoneDark = "#344248";
const stoneMid = "#718083";
const stoneLight = "#aeb9b6";
const ironDark = "#142f34";
const iron = "#24474b";
const ironLight = "#3b6263";
const brassDark = "#9b7139";
const brass = "#d4a65b";
const brassLight = "#f1cb7d";
// Square paved base with clipped corners.
for (let x = 7; x <= 41; x++) {
for (let y = 7; y <= 41; y++) {
const corner = Math.min(x - 7, 41 - x) + Math.min(y - 7, 41 - y);
if (corner < 5) continue;
box(x, y, 0, x, y, 1, corner < 7 ? "#39494b" : "#566365");
set(x, y, 2, corner < 7 ? stoneDark : "#899491");
// Offset rows of rectangular paving stones.
const row = Math.floor((y - 7) / 4);
const seamX = ((x - 7 + (row % 2) * 2) % 5) === 0;
const seamY = (y - 7) % 4 === 0;
if (corner > 7 && !seamX && !seamY) {
const n = rand();
set(x, y, 3, n < 0.18 ? "#889693" : n < 0.72 ? stoneLight : "#c0c9c3");
} else if (corner > 7) {
set(x, y, 3, "#697b7a");
}
}
}
// A few warm-colored stones among the paving.
for (const [x, y] of [[13, 15], [36, 19], [14, 31], [34, 33]]) {
box(x, y, 4, x + 1, y + 1, 4, brassDark);
set(x, y, 5, brass);
}
// Heavy, tiered foot of the lamp.
box(18, 18, 4, 30, 30, 5, ironDark);
box(19, 19, 6, 29, 29, 7, iron);
box(20, 20, 8, 28, 28, 9, ironDark);
box(21, 21, 10, 27, 27, 11, ironLight);
box(22, 22, 12, 26, 26, 13, ironDark);
for (const [x, y] of [[20, 20], [28, 20], [20, 28], [28, 28]]) {
set(x, y, 8, brassDark);
set(x, y, 9, brass);
}
box(19, 19, 5, 29, 19, 5, ironLight);
box(19, 19, 6, 19, 29, 6, ironLight);
// Slender square post, with shaded sides and periodic cast-iron collars.
box(22, 22, 13, 26, 26, 32, iron);
box(22, 22, 13, 22, 26, 32, ironLight);
box(22, 22, 13, 26, 22, 32, "#315759");
box(26, 23, 13, 26, 26, 32, ironDark);
for (const z of [14, 16, 29, 31]) {
box(21, 21, z, 27, 27, z, z === 16 ? ironLight : ironDark);
}
box(23, 21, 15, 25, 21, 15, brassDark);
// Projecting sign, facing the viewer.
box(6, 18, 20, 22, 22, 27, ironDark);
box(7, 17, 21, 21, 17, 26, iron);
box(6, 18, 20, 8, 22, 27, "#10282e");
box(7, 18, 27, 22, 22, 27, ironLight);
box(7, 18, 20, 22, 22, 20, "#10282e");
box(21, 20, 22, 24, 24, 25, ironDark);
// Raised block lettering: LAMP.
const letters = [
["100", "100", "100", "100", "111"],
["010", "101", "111", "101", "101"],
["101", "111", "111", "101", "101"],
["110", "101", "110", "100", "100"]
];
for (let i = 0; i < letters.length; i++) {
for (let row = 0; row < 5; row++) {
for (let col = 0; col < 3; col++) {
if (letters[i][row][col] === "1") {
set(7 + i * 4 + col, 16, 25 - row, row === 4 ? brassDark : brassLight);
}
}
}
}
set(7, 16, 26, brass);
set(21, 16, 26, brass);
// Bracket and stepped underside of the lantern.
box(21, 21, 32, 27, 27, 33, ironDark);
box(19, 19, 34, 29, 29, 34, iron);
box(18, 18, 35, 30, 30, 35, ironDark);
box(17, 17, 36, 31, 31, 36, ironLight);
// Warm glass on all four sides, with depth and a brighter center.
box(18, 18, 37, 30, 30, 40, brassDark);
box(19, 17, 37, 29, 17, 40, "#d39b48");
box(19, 31, 37, 29, 31, 40, "#c39149");
box(17, 19, 37, 17, 29, 40, "#d49e51");
box(31, 19, 37, 31, 29, 40, "#bd873f");
box(21, 17, 38, 25, 17, 40, brassLight);
box(17, 21, 38, 17, 25, 40, "#edba69");
// Sturdy corner posts and horizontal mullions.
for (const x of [17, 30]) {
for (const y of [17, 30]) box(x, y, 36, x + 1, y + 1, 41, ironDark);
}
box(17, 16, 38, 31, 17, 38, iron);
box(17, 30, 38, 31, 31, 38, ironDark);
box(16, 17, 38, 17, 31, 38, iron);
box(30, 17, 38, 31, 31, 38, ironDark);
for (const x of [23, 27]) {
box(x, 16, 36, x, 17, 40, ironDark);
box(x, 30, 36, x, 31, 40, ironDark);
}
for (const y of [23, 27]) {
box(16, y, 36, 17, y, 40, ironDark);
box(30, y, 36, 31, y, 40, ironDark);
}
box(16, 16, 40, 32, 32, 41, ironDark);
box(17, 16, 41, 31, 16, 41, ironLight);
box(16, 17, 41, 16, 31, 41, ironLight);
// Broad layered, shallow pyramidal cap.
box(14, 14, 42, 34, 34, 42, ironDark);
box(15, 15, 43, 33, 33, 43, ironLight);
box(18, 18, 44, 30, 30, 44, iron);
box(21, 21, 45, 27, 27, 45, ironDark);
box(23, 23, 46, 25, 25, 46, brassDark);
set(24, 24, 46, brass);import { draw } from "./assets/voxel";
import { farola } from "./assets/farola";
// En cada cuadro: parado sobre (x, y), el centro de su base.
draw(ctx, farola, 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 farola
# Con las herramientas de Fogón (conector)
add_assets({ slug: "<tu-juego>", ids: ["farola"] })
# Queda en client/assets/farola.ts
# https://fogon.page/object/farola