← Basics3D assetfogon/cofre-del-tesoro-v4
Cofre del tesoro
Drag to turn it// «Cofre del tesoro» · gpt-6-sol (medium)
// Treasure chest («Cofre del tesoro»). One of several variations of this object: follow the reference picture closely.
// Open treasure chest, facing -y.
const dark = "#392313";
const edge = "#603819";
const wood = "#8c5225";
const warm = "#ad672d";
const lightWood = "#c17a37";
const goldDark = "#a37120";
const gold = "#e2ae3a";
const goldLight = "#f8d867";
// Feet and dark, solid bottom.
box(6, 11, 0, 42, 35, 3, dark);
box(8, 12, 2, 40, 34, 5, edge);
for (const x of [7, 39]) for (const y of [12, 32]) {
box(x, y, 0, x + 3, y + 3, 5, "#62401e");
box(x, y, 0, x + 3, y + 3, 1, "#795122");
}
// Hollow wooden body.
box(6, 11, 4, 42, 35, 18, edge);
box(8, 13, 6, 40, 33, 19, wood);
box(10, 15, 13, 38, 31, 21, "#281d12");
box(11, 16, 13, 37, 30, 14, "#60421c");
// Large inset panels on the front.
for (const [a, b] of [[11, 22], [27, 38]]) {
box(a, 10, 6, b, 10, 16, "#482a18");
box(a + 1, 9, 7, b - 1, 9, 15, goldDark);
box(a + 2, 8, 8, b - 2, 8, 14, wood);
box(a + 3, 7, 10, b - 3, 7, 13, warm);
box(a + 2, 8, 14, b - 2, 8, 14, lightWood);
box(a + 2, 8, 8, b - 2, 8, 8, "#70401e");
}
// Paneling on the visible left end.
box(5, 14, 6, 5, 32, 16, "#482b17");
for (const [a, b] of [[15, 21], [24, 31]]) {
box(4, a, 7, 4, b, 15, goldDark);
box(3, a + 1, 8, 3, b - 1, 14, wood);
box(3, a + 1, 13, 3, b - 1, 13, warm);
}
// Horizontal base rails.
box(5, 10, 3, 43, 12, 5, "#553318");
box(7, 9, 4, 41, 9, 5, goldDark);
box(8, 9, 5, 40, 9, 5, gold);
box(5, 12, 4, 7, 35, 5, goldDark);
box(6, 13, 5, 6, 34, 5, gold);
// Heavy corner fittings and front uprights.
for (const x of [6, 40]) {
box(x, 9, 5, x + 2, 11, 20, goldDark);
box(x, 8, 8, x + 1, 9, 17, gold);
box(x, 8, 18, x + 2, 11, 20, goldLight);
box(x, 9, 4, x + 2, 12, 6, gold);
for (const z of [7, 13, 18]) set(x + 1, 7, z, goldLight);
}
for (const y of [12, 33]) {
box(5, y, 5, 7, y + 2, 19, goldDark);
box(4, y, 8, 5, y + 1, 17, gold);
box(4, y, 18, 8, y + 2, 20, goldLight);
}
// Bright lip all around the open mouth.
box(6, 10, 19, 42, 12, 21, goldDark);
box(7, 9, 20, 41, 10, 21, goldLight);
box(6, 33, 19, 42, 36, 21, goldDark);
box(8, 34, 21, 40, 35, 21, gold);
box(5, 12, 19, 8, 34, 21, gold);
box(40, 12, 19, 43, 34, 21, gold);
box(9, 13, 20, 39, 13, 20, "#e6af39");
box(9, 32, 20, 39, 32, 20, "#e6af39");
// Individual wood grain on broad surfaces.
for (let i = 0; i < 85; i++) {
const x = 11 + Math.floor(rand() * 28);
const z = 6 + Math.floor(rand() * 11);
if (get(x, 8, z) === wood) set(x, 7, z, rand() < 0.5 ? "#9b5927" : "#76401e");
}
// Coins spilling into the open top.
for (let i = 0; i < 53; i++) {
const x = 12 + Math.floor(rand() * 25);
const y = 15 + Math.floor(rand() * 16);
const z = 18 + Math.floor(rand() * 4);
const c = rand() < 0.38 ? goldLight : rand() < 0.55 ? gold : "#c38b25";
box(x, y, z, x + (rand() < 0.55 ? 1 : 0), y + 1, z, c);
}
for (const [x, y, h] of [[13, 20, 3], [17, 16, 2], [21, 28, 3], [30, 17, 3], [36, 23, 2]]) {
cylinder(x, y, 19, 2, h, goldDark);
cylinder(x, y, 19 + h, 2, 1, goldLight);
set(x, y, 20 + h, "#fff0a2");
}
// Big faceted ruby and smaller turquoise gems.
ellipsoid(21, 22, 23, 2.4, 2.2, 2.8, "#9c254b");
box(20, 21, 24, 22, 22, 25, "#dc436b");
box(21, 21, 26, 21, 22, 26, "#fb7991");
set(20, 20, 24, "#f2607b");
ellipsoid(29, 24, 22, 2.3, 1.7, 1.6, "#158e91");
box(28, 23, 23, 30, 24, 23, "#43d2ce");
set(29, 23, 24, "#9cf2db");
ellipsoid(34, 19, 22, 1.7, 1.5, 1.5, "#238e9c");
set(34, 18, 23, "#90e9dc");
// Raised lid: a thick wooden panel angled up toward the back.
for (let y = 31; y <= 44; y++) {
const z = 22 + Math.round((y - 31) * 0.68);
box(7, y, z, 41, y, z + 3, dark);
box(8, y, z + 1, 40, y, z + 3,
y % 5 === 0 ? "#a7652e" : y % 4 === 0 ? warm : lightWood);
box(10, y, z + 4, 38, y, z + 4,
y < 35 ? "#bd7837" : y < 41 ? warm : "#d18a3e");
box(7, y, z + 2, 9, y, z + 3, goldDark);
box(39, y, z + 2, 41, y, z + 3, goldDark);
}
// Broad lengthwise planks and dark seams across the lid.
for (let y = 34; y <= 43; y++) {
const z = 22 + Math.round((y - 31) * 0.68) + 5;
if (y === 35 || y === 40) box(9, y, z, 39, y, z, "#71401e");
else if (y === 36 || y === 41) box(10, y, z, 38, y, z, "#db9448");
}
// Golden bands running over the lid, and their rivets.
for (const x of [12, 36]) {
for (let y = 32; y <= 44; y++) {
const z = 22 + Math.round((y - 31) * 0.68);
box(x, y, z + 4, x + 2, y, z + 5, goldDark);
box(x + 1, y, z + 5, x + 2, y, z + 5, goldLight);
}
for (const y of [34, 43]) {
const z = 22 + Math.round((y - 31) * 0.68);
set(x + 1, y, z + 6, "#fff0a0");
}
}
// Thick capped front and rear edges of the lid.
box(7, 30, 22, 41, 31, 25, "#75421e");
box(7, 30, 25, 41, 31, 26, goldDark);
box(9, 29, 25, 39, 29, 25, gold);
box(7, 44, 30, 41, 45, 33, goldDark);
box(9, 45, 32, 39, 45, 33, gold);
// Rounded-looking, gold-edged wooden end cap on the left.
for (let y = 30; y <= 44; y++) {
const z = 22 + Math.round((Math.max(31, y) - 31) * 0.68);
box(5, y, z, 7, y, z + 3, "#66401e");
set(5, y, z + 3, y % 3 === 0 ? goldLight : goldDark);
}
box(5, 30, 21, 7, 33, 24, goldDark);
box(5, 34, 23, 6, 38, 25, "#75451e");
set(4, 33, 23, gold);
set(4, 36, 25, goldLight);
// Central dangling gold hasp and black lock.
box(23, 8, 15, 28, 9, 21, goldDark);
box(24, 7, 14, 27, 8, 19, gold);
box(24, 6, 12, 27, 8, 16, "#b98020");
box(25, 5, 13, 26, 6, 16, "#2d281b");
box(25, 5, 16, 26, 5, 16, "#56431f");
box(24, 7, 19, 27, 7, 20, goldLight);import { draw } from "./assets/voxel";
import { cofreDelTesoroV4 } from "./assets/cofre-del-tesoro-v4";
// Every frame: standing on (x, y), the centre of its base.
draw(ctx, cofreDelTesoroV4, 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-v4
# With Fogón's tools (connector)
add_assets({ slug: "<your-game>", ids: ["cofre-del-tesoro-v4"] })
# It lands in client/assets/cofre-del-tesoro-v4.ts
# https://fogon.page/object/cofre-del-tesoro-v4