← Basics3D assetfogon/cofre-del-tesoro
Cofre del tesoro
Drag to turn it// «Cofre del tesoro» · gpt-6-sol (medium)
// Treasure chest («Cofre del tesoro»).
const woodDark = "#512819";
const wood = "#71371e";
const woodLight = "#914923";
const woodHi = "#a95b2b";
const goldDark = "#9a641d";
const gold = "#dc9c30";
const goldLight = "#ffd15a";
const goldPale = "#ffe487";
// Solid chest body, with horizontal wooden planks.
box(6, 11, 2, 42, 36, 17, woodDark);
box(8, 12, 0, 40, 34, 2, "#623018");
for (let z = 3; z <= 17; z++) {
const seam = z === 6 || z === 11 || z === 16;
box(6, 10, z, 42, 12, z, seam ? "#462417" : z % 4 === 0 ? woodLight : wood);
box(5, 12, z, 7, 36, z, seam ? "#492617" : z % 5 === 0 ? woodLight : "#67351e");
box(41, 12, z, 43, 36, z, seam ? "#482518" : z % 5 === 0 ? "#8b4522" : wood);
}
for (let i = 0; i < 150; i++) {
const x = 9 + Math.floor(rand() * 31);
const z = 4 + Math.floor(rand() * 13);
if (rand() < 0.4) set(x, 9, z, rand() < 0.5 ? "#a55529" : "#5c2b19");
}
for (let y = 14; y <= 34; y += 5) {
for (let z = 5; z <= 16; z += 5) {
set(4, y, z, "#874321");
set(44, y, z, "#613019");
}
}
// Dark, recessed opening beneath the treasure.
box(8, 13, 17, 40, 34, 18, "#38251a");
box(10, 15, 18, 38, 32, 18, "#734321");
// Bright, thick rim around the open box.
box(5, 9, 18, 43, 12, 19, goldDark);
box(5, 9, 20, 43, 11, 20, goldLight);
box(5, 10, 18, 8, 36, 19, gold);
box(40, 10, 18, 43, 36, 19, gold);
box(6, 34, 18, 42, 37, 19, gold);
box(8, 12, 19, 40, 12, 20, goldPale);
box(8, 13, 19, 8, 34, 20, goldLight);
box(40, 13, 19, 40, 34, 20, goldLight);
box(9, 35, 19, 39, 35, 20, goldLight);
for (const x of [7, 41]) {
box(x - 1, 10, 20, x + 1, 12, 21, goldPale);
box(x - 1, 10, 2, x + 1, 13, 4, goldDark);
box(x, 9, 4, x + 1, 11, 17, gold);
box(x, 9, 8, x + 1, 9, 15, goldLight);
}
box(7, 10, 1, 41, 13, 2, goldDark);
box(8, 9, 3, 40, 10, 3, gold);
box(9, 9, 16, 39, 10, 16, goldDark);
// Raised lid: its front surface leans backward as it rises.
for (let z = 20; z <= 38; z++) {
const yf = 33 + Math.round((z - 20) * 0.36);
const seam = z === 24 || z === 29 || z === 34;
for (let x = 7; x <= 41; x++) {
const edge = x <= 10 || x >= 39;
const c = edge
? (x <= 8 ? "#633018" : "#8d4522")
: seam ? "#4f281a"
: z % 5 === 0 ? woodHi : wood;
box(x, yf, z, x, yf + 2, z, c);
if (!edge && !seam && rand() < 0.055)
set(x, yf - 1, z, rand() < 0.5 ? "#ae602d" : "#54291a");
}
}
// Heavy wooden ends and brass edging of the lid.
for (let z = 21; z <= 37; z++) {
const yf = 33 + Math.round((z - 20) * 0.36);
box(6, yf, z, 8, yf + 3, z, "#643118");
box(40, yf, z, 42, yf + 3, z, "#6e351a");
set(9, yf - 1, z, goldDark);
set(40, yf - 1, z, goldDark);
}
for (let z = 36; z <= 39; z++) {
const yf = 33 + Math.round((z - 20) * 0.36);
box(6, yf - 1, z, 42, yf + 3, z, z >= 38 ? gold : goldDark);
box(8, yf - 2, z, 40, yf - 2, z, goldLight);
}
box(8, 32, 20, 40, 35, 21, goldDark);
box(10, 32, 21, 38, 33, 21, goldLight);
for (const x of [10, 39]) {
box(x, 33, 22, x + 1, 34, 25, gold);
box(x, 38, 35, x + 1, 40, 38, goldLight);
}
// Central ornamental strap on the inner lid.
for (let z = 22; z <= 37; z++) {
const yf = 33 + Math.round((z - 20) * 0.36);
box(23, yf - 2, z, 25, yf - 1, z, z % 4 === 0 ? goldLight : gold);
set(24, yf - 3, z, goldDark);
}
box(21, 38, 37, 27, 41, 39, goldDark);
box(22, 38, 38, 26, 39, 39, goldLight);
box(22, 32, 20, 26, 34, 22, goldLight);
// Piles of chunky, irregular gold coins.
for (let i = 0; i < 115; i++) {
const x = 11 + Math.floor(rand() * 27);
const y = 15 + Math.floor(rand() * 17);
if ((x > 15 && x < 22 && y > 20 && y < 28) ||
(x > 26 && x < 33 && y > 18 && y < 26)) continue;
const z = 19 + Math.floor(rand() * 3);
const shade = rand();
box(x, y, z, x + (rand() < 0.32 ? 1 : 0), y + 1, z,
shade < 0.2 ? goldDark : shade < 0.65 ? gold : goldLight);
if (rand() < 0.28) set(x, y, z + 1, goldPale);
}
for (const [x, y] of [[12, 23], [15, 30], [23, 17], [35, 19], [36, 29], [26, 30]]) {
box(x, y, 20, x + 3, y + 2, 20, gold);
box(x + 1, y, 21, x + 3, y + 1, 21, goldLight);
set(x + 2, y, 22, goldPale);
}
// Three large faceted jewels nestled among the coins.
ellipsoid(18, 24, 22, 4, 3, 3, "#087f70");
box(16, 21, 22, 19, 24, 23, "#13b89e");
box(17, 22, 24, 19, 24, 25, "#48d9b4");
set(18, 22, 26, "#a2f5d2");
set(16, 21, 23, "#b6f9d7");
ellipsoid(29, 22, 22, 3, 3, 3, "#0879a3");
box(27, 20, 22, 30, 23, 24, "#18a9d0");
box(28, 21, 25, 30, 22, 25, "#57d5e5");
set(29, 21, 26, "#b6f3e9");
box(31, 28, 21, 35, 31, 22, "#7942a0");
box(32, 28, 23, 34, 30, 24, "#b363c4");
set(33, 28, 25, "#f4acd9");
set(31, 28, 23, "#ed94d7");
// Front lock plate, dangling turquoise charm, and side ornament.
box(22, 8, 11, 28, 10, 17, goldDark);
box(23, 7, 12, 27, 8, 16, goldLight);
box(24, 6, 10, 26, 9, 13, gold);
box(24, 6, 13, 25, 6, 15, goldPale);
set(25, 6, 14, "#76451d");
box(27, 8, 7, 29, 9, 10, gold);
box(28, 7, 5, 30, 9, 8, "#128e87");
box(28, 6, 6, 29, 7, 8, "#4bd5b5");
set(29, 6, 8, "#adf5cd");
box(4, 20, 7, 5, 25, 12, goldDark);
box(3, 21, 9, 5, 24, 10, goldLight);
box(4, 22, 7, 5, 23, 12, gold);
box(3, 22, 9, 3, 23, 10, woodDark);
set(3, 20, 9, goldPale);
set(3, 25, 10, goldPale);
// Small rivets along the front and side bands.
for (const x of [9, 15, 35, 40]) {
set(x, 8, 19, goldPale);
set(x, 9, 3, goldLight);
}
for (const y of [13, 32]) {
set(4, y, 18, goldPale);
set(43, y, 18, goldLight);
}import { draw } from "./assets/voxel";
import { cofreDelTesoro } from "./assets/cofre-del-tesoro";
// Every frame: standing on (x, y), the centre of its base.
draw(ctx, cofreDelTesoro, 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 cofre-del-tesoro
# With Fogón's tools (connector)
add_assets({ slug: "<your-game>", ids: ["cofre-del-tesoro"] })
# It lands in client/assets/cofre-del-tesoro.ts
# https://fogon.page/object/cofre-del-tesoro