← Level pieces 23D assetfogon/nivel-llave-dorada
Llave dorada
Drag to turn it// «Llave dorada» · gpt-6-sol (medium)
// A big ornate golden key lying in the air horizontally along x, upright facing -y: a round bow with a heart-shaped hole on the left, a long shaft and two square bits on the right end, 40 long, 4 thick, shiny gold in 3 shades with a white highlight, floating at z 12.
const gold = "#f5b52d";
const light = "#ffdc57";
const shadow = "#c98217";
const gleam = "#fff8cf";
// Lower the entire key five blocks so its lowest blocks reach z = 0.
const keySet = (x, y, z, color) => set(x, y, z - 5, color);
const keyBox = (x0, y0, z0, x1, y1, z1, color) =>
box(x0, y0, z0 - 5, x1, y1, z1 - 5, color);
part("llave", [24, 24, 14]);
function goldAt(x, y, z) {
if (y === 25 || z <= 9) return shadow;
if (y === 22 && z >= 14) return light;
if (z >= 18) return light;
return gold;
}
// Four-block-thick round bow.
for (let x = 4; x <= 20; x++) {
for (let z = 5; z <= 23; z++) {
const dx = (x - 12) / 8.5;
const dz = (z - 14) / 9.5;
if (dx * dx + dz * dz > 1) continue;
for (let y = 22; y <= 25; y++) {
keySet(x, y, z, goldAt(x, y, z));
}
}
}
// Heart-shaped hole.
const heart = {
19: [[9, 10], [14, 15]],
18: [[8, 11], [13, 16]],
17: [[8, 16]],
16: [[8, 16]],
15: [[9, 15]],
14: [[9, 15]],
13: [[10, 14]],
12: [[11, 13]],
11: [[12, 12]]
};
for (const [height, spans] of Object.entries(heart)) {
for (const [a, b] of spans) {
keyBox(a, 22, Number(height), b, 25, Number(height), null);
}
}
// Shaft and two square teeth.
for (let x = 19; x <= 43; x++) {
for (let y = 22; y <= 25; y++) {
for (let z = 12; z <= 15; z++) {
keySet(x, y, z, goldAt(x, y, z));
}
}
}
keyBox(33, 22, 8, 36, 25, 11, gold);
keyBox(40, 22, 7, 43, 25, 11, gold);
keyBox(33, 25, 8, 36, 25, 11, shadow);
keyBox(40, 25, 7, 43, 25, 11, shadow);
keyBox(33, 22, 10, 36, 22, 11, light);
keyBox(40, 22, 9, 43, 22, 11, light);
// White highlights on the viewer-facing side.
for (const [x, z] of [
[7, 19], [8, 20], [9, 21], [10, 22],
[11, 22], [12, 22], [13, 22], [14, 21]
]) {
if (get(x, 22, z - 5)) keySet(x, 22, z, gleam);
}
keyBox(24, 22, 15, 30, 22, 15, gleam);
keySet(35, 22, 15, gleam);
keySet(41, 22, 15, gleam);
animate("llave", { type: "spin", axis: "z", speed: -2 });
animate("llave", { type: "bob", axis: "z", amplitude: 1.5 });import { draw } from "./assets/voxel";
import { nivelLlaveDorada } from "./assets/nivel-llave-dorada";
// Every frame: standing on (x, y), the centre of its base.
draw(ctx, nivelLlaveDorada, 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-llave-dorada
# With Fogón's tools (connector)
add_assets({ slug: "<your-game>", ids: ["nivel-llave-dorada"] })
# It lands in client/assets/nivel-llave-dorada.ts
# https://fogon.page/object/nivel-llave-dorada