← Level kit3D assetfogon/nivel-cofre-de-premio
Cofre de premio
Drag to turn it// «Cofre de premio» · gpt-6-sol (medium)
// A treasure chest, about 36 wide on x, 24 deep on y, 30 tall, centered, facing -y: a rectangular brown wooden box with plank lines and a rounded barrel-shaped lid (half cylinder along x) on top, gold metal bands around the corners and two vertical bands over the lid, a big gold lock plate with a dark keyhole in the middle of the front. The lid is slightly open at the front and gold coins and a red gem peek out of the gap, with a few coins on the ground in front.
// Treasure chest: 36 blocks wide, 24 deep, 30 tall.
const wood = "#a95825";
const woodLight = "#cb7835";
const woodDark = "#76391e";
const gold = "#f7b928";
const goldLight = "#ffdf61";
const goldDark = "#bd7818";
// Solid wooden box.
box(6, 12, 2, 41, 35, 17, wood);
box(7, 12, 3, 40, 12, 16, woodLight);
box(6, 13, 3, 6, 34, 16, "#8b451f");
box(41, 13, 3, 41, 34, 16, "#8b451f");
// Clean horizontal plank seams and narrow highlights.
for (const z of [6, 11, 15]) {
box(9, 11, z, 38, 12, z, woodDark);
box(9, 11, z + 1, 38, 11, z + 1, "#df8b40");
box(6, 14, z, 6, 34, z, woodDark);
box(41, 14, z, 41, 34, z, woodDark);
}
box(8, 11, 2, 39, 12, 3, goldDark);
box(8, 11, 16, 39, 12, 17, goldDark);
// Four sturdy feet, reaching the floor.
for (const x of [7, 38]) for (const y of [13, 32]) {
box(x, y, 0, x + 3, y + 3, 4, woodDark);
box(x, y, 1, x + 3, y, 3, woodLight);
}
// Gold-reinforced corners.
for (const x of [6, 39]) {
box(x, 11, 2, x + 2, 12, 17, gold);
box(x, 11, 3, x, 11, 16, goldLight);
box(x, 35, 2, x + 2, 36, 17, goldDark);
}
for (const y of [12, 33]) {
box(6, y, 3, 7, y + 2, 16, gold);
box(40, y, 3, 41, y + 2, 16, gold);
}
// Dark opening beneath the raised front of the lid.
box(9, 12, 18, 38, 17, 20, "#42251c");
box(10, 13, 18, 37, 18, 18, goldDark);
// Coins spilling into the opening.
for (const [x, y, z] of [
[12, 13, 19], [15, 14, 19], [18, 13, 18],
[28, 14, 19], [34, 13, 19], [37, 15, 18]
]) {
cylinder(x, y, z, 2, 1, gold);
set(x, y - 1, z + 1, goldLight);
}
// Rounded, barrel-shaped lid, lifted slightly higher at the front.
function lidBase(y) {
return 19 + Math.round((35 - y) * 3 / 23);
}
function lidTop(y) {
const t = (y - 23.5) / 11.8;
return lidBase(y) + Math.round(8 * Math.sqrt(Math.max(0, 1 - t * t)));
}
for (let y = 12; y <= 35; y++) {
const bottom = lidBase(y);
const top = lidTop(y);
box(6, y, bottom, 41, y, top, "#985022");
// Crisp curved wooden surface and dark lower rim.
box(7, y, top, 40, y, top, y < 24 ? woodLight : wood);
box(7, y, bottom, 40, y, bottom, woodDark);
// Gold edging on both ends and two straps sweeping over the curve.
for (const x of [6, 41]) {
box(x, y, bottom, x, y, top, goldDark);
set(x, y, top, goldLight);
}
for (const x of [15, 30]) {
box(x, y, top, x + 2, y, top, gold);
box(x, y, top + 1, x + 2, y, top + 1, goldLight);
}
}
// Front lip, curved end caps, and readable band ends.
box(8, 11, 21, 39, 12, 22, woodDark);
box(9, 11, 22, 38, 11, 22, woodLight);
for (const x of [15, 30]) {
box(x, 10, 21, x + 2, 11, 24, gold);
box(x, 10, 23, x + 2, 10, 23, goldLight);
}
for (const x of [6, 40]) {
box(x, 11, 20, x + 1, 12, 23, gold);
}
// Chunky front lock plate, with a dark keyhole.
box(20, 10, 11, 27, 11, 20, goldDark);
box(21, 9, 12, 26, 10, 19, gold);
box(22, 9, 18, 25, 9, 19, goldLight);
box(23, 8, 15, 24, 9, 17, "#382820");
box(23, 8, 13, 24, 9, 14, "#382820");
set(22, 9, 12, goldLight);
set(25, 9, 12, goldLight);
// A bright red gem peeking out beside the lock.
box(31, 10, 19, 33, 12, 21, "#af1736");
box(32, 9, 20, 32, 11, 22, "#f44157");
set(32, 9, 22, "#ffabb1");
// A few thick gold coins on the ground in front.
for (const [x, y] of [[13, 7], [17, 5], [32, 7], [36, 9]]) {
cylinder(x, y, 0, 2, 2, goldDark);
cylinder(x, y, 2, 2, 1, gold);
set(x - 1, y - 1, 2, goldLight);
}import { draw } from "./assets/voxel";
import { nivelCofreDePremio } from "./assets/nivel-cofre-de-premio";
// Every frame: standing on (x, y), the centre of its base.
draw(ctx, nivelCofreDePremio, 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 nivel-cofre-de-premio
# With Fogón's tools (connector)
add_assets({ slug: "<your-game>", ids: ["nivel-cofre-de-premio"] })
# It lands in client/assets/nivel-cofre-de-premio.ts
# https://fogon.page/object/nivel-cofre-de-premio