← Level pieces 23D assetfogon/nivel-cerradura
Bloque con cerradura
Drag to turn it// «Bloque con cerradura» · gpt-6-sol (medium)
// A locked block: a solid cube 40x40x40 centered on the floor, golden yellow with darker gold edges, and on the front face (-y) and back a big black keyhole shape in a round silver plate; small rivets in the corners.
// Hollow 40 × 40 × 40 block: thick walls keep it visually solid
// without filling its unseen interior.
const gold = "#f4bb27";
box(4, 4, 0, 43, 5, 39, gold); // front wall
box(4, 42, 0, 43, 43, 39, gold); // back wall
box(4, 6, 0, 5, 41, 39, gold); // left wall
box(42, 6, 0, 43, 41, 39, gold); // right wall
box(6, 6, 0, 41, 41, 1, gold); // bottom
box(6, 6, 38, 41, 41, 39, gold); // top
// Bright upper surface and crisp dark-gold edges.
box(4, 4, 39, 43, 43, 39, "#ffda55");
for (const y of [4, 43]) {
box(4, y, 0, 43, y, 1, "#bb7f12");
box(4, y, 38, 43, y, 39, "#d79b1a");
box(4, y, 2, 5, y, 37, "#cc8c13");
box(42, y, 2, 43, y, 37, "#cc8c13");
}
for (const x of [4, 43]) {
box(x, 5, 0, x, 42, 1, "#bb7f12");
box(x, 5, 38, x, 42, 39, "#d79b1a");
}
box(5, 5, 39, 42, 42, 39, "#ffda55");
// Sparse highlights keep the broad faces clean.
for (let i = 0; i < 70; i++) {
const x = 7 + Math.floor(rand() * 34);
const z = 3 + Math.floor(rand() * 34);
set(x, 4, z, rand() < 0.5 ? "#ffd44b" : "#edb425");
set(x, 43, z, rand() < 0.5 ? "#f9c638" : "#e5a91e");
}
const cx = 23.5;
const cz = 20;
for (const front of [true, false]) {
const bevelY = front ? 3 : 44;
const plateY = front ? 2 : 45;
const detailY = front ? 1 : 46;
// Raised circular silver plate, on both front and back.
for (let x = 10; x <= 37; x++) {
for (let z = 6; z <= 34; z++) {
const dx = x - cx;
const dz = z - cz;
const d = Math.sqrt(dx * dx + dz * dz);
if (d <= 13) {
set(x, bevelY, z,
d > 11.7 && dz > 0 ? "#dce5e6" : "#748390");
if (d <= 11.7) {
set(x, plateY, z,
d > 10.6 ? "#a5b1b8" :
dz > 3 || dx < -3 ? "#e3eced" : "#bdcbd0");
}
}
}
}
// Large, unmistakable black keyhole.
for (let x = 15; x <= 32; x++) {
for (let z = 11; z <= 30; z++) {
const dx = x - cx;
const head = dx * dx + (z - 25) * (z - 25) <= 4.5 * 4.5;
const stem = z >= 13 && z <= 23 &&
Math.abs(dx) <= (z <= 16 ? 3 : 2);
if (head || stem) {
set(x, detailY, z,
stem && z === 13 ? "#26313a" : "#17212a");
}
}
}
// Four small raised rivets in the gold corners.
for (const x of [9, 38]) {
for (const z of [5, 34]) {
for (let dx = -2; dx <= 2; dx++) {
for (let dz = -2; dz <= 2; dz++) {
const r2 = dx * dx + dz * dz;
if (r2 <= 4) {
set(x + dx, plateY, z + dz, "#75858c");
if (r2 <= 2) {
set(x + dx, detailY, z + dz,
dx <= 0 && dz >= 0 ? "#f4f8f4" : "#bbc9ca");
}
}
}
}
}
}
}import { draw } from "./assets/voxel";
import { nivelCerradura } from "./assets/nivel-cerradura";
// Every frame: standing on (x, y), the centre of its base.
draw(ctx, nivelCerradura, 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-cerradura
# With Fogón's tools (connector)
add_assets({ slug: "<your-game>", ids: ["nivel-cerradura"] })
# It lands in client/assets/nivel-cerradura.ts
# https://fogon.page/object/nivel-cerradura