← Piezas de nivel 2Objeto 3Dfogon/nivel-resorte
Resorte
Arrastrá para girarlo// «Resorte» · gpt-6-sol (medium)
// A bouncy spring pad: a square dark grey metal base 24x24, 4 tall, centered; on it a chunky coiled spring of light silver steel (a helix of radius 9, 3 thick, 4 turns, about 14 tall), topped by a round red pad radius 11, 3 thick with a lighter top and a white arrow pointing up.
// 24 × 24 dark metal base
box(12, 12, 0, 35, 35, 3, "#343b45");
box(13, 13, 3, 34, 34, 3, "#535c68");
box(15, 15, 3, 32, 32, 3, "#68727e");
for (const x of [15, 32]) {
for (const y of [15, 32]) {
box(x, y, 4, x + 1, y + 1, 4, "#aeb8c1");
set(x, y, 4, "#e1e7e9");
}
}
// The spring, its mount, and the pad bounce together.
part("resorte", [24, 24, 4]);
cylinder(24, 24, 4, 5, 2, "#78838d");
cylinder(24, 24, 5, 4, 1, "#c8d1d6");
// Four chunky, closely spaced turns of silver steel.
const steps = 320;
for (let i = 0; i < steps; i++) {
const a0 = i / steps * Math.PI * 8;
const a1 = (i + 1) / steps * Math.PI * 8;
const x0 = 24 + 9 * Math.cos(a0), y0 = 24 + 9 * Math.sin(a0);
const x1 = 24 + 9 * Math.cos(a1), y1 = 24 + 9 * Math.sin(a1);
const z0 = 5.5 + 13 * i / steps;
const z1 = 5.5 + 13 * (i + 1) / steps;
line(x0, y0, z0, x1, y1, z1, 1.65, "#82909b");
line(x0 - 0.35, y0 - 0.35, z0 + 0.35,
x1 - 0.35, y1 - 0.35, z1 + 0.35, 1.05, "#d6e0e4");
line(x0 - 0.55, y0 - 0.55, z0 + 0.65,
x1 - 0.55, y1 - 0.55, z1 + 0.65, 0.35, "#f2f6f5");
}
// Three-block-thick red circular cap.
for (let x = 13; x <= 35; x++) {
for (let y = 13; y <= 35; y++) {
const d = Math.hypot(x - 24, y - 24);
if (d > 11) continue;
set(x, y, 19, "#a82736");
set(x, y, 20, d > 10 ? "#c82e3c" : "#e23a48");
set(x, y, 21, d > 9.7 ? "#de3946" : "#fb6268");
}
}
// Bold white upward arrow on the top surface.
for (let y = 17; y <= 28; y++) {
for (let x = 23; x <= 24; x++) set(x, y, 21, "#fffaf0");
}
for (let y = 26; y <= 32; y++) {
const halfWidth = Math.floor((32 - y) * 0.92);
for (let x = 24 - halfWidth; x <= 24 + halfWidth; x++) {
set(x, y, 21, "#fffaf0");
}
}
animate("resorte", { type: "bob", axis: "z", amplitude: 2.5, speed: 5 });import { draw } from "./assets/voxel";
import { nivelResorte } from "./assets/nivel-resorte";
// En cada cuadro: parado sobre (x, y), el centro de su base.
draw(ctx, nivelResorte, x, y, { size: 64, angle: 0, t: performance.now() / 1000 });
// size: lo que mide en px su lado más largo
// angle: giro sobre el piso, en radianes
// t: segundos; si se mueve, se anima solo con eso# En una terminal, en la carpeta del juego
fogon assets add nivel-resorte
# Con las herramientas de Fogón (conector)
add_assets({ slug: "<tu-juego>", ids: ["nivel-resorte"] })
# Queda en client/assets/nivel-resorte.ts
# https://fogon.page/object/nivel-resorte