← Piezas de nivel 2Objeto 3Dfogon/nivel-iman
Imán
Arrastrá para girarlo// «Imán» · gpt-6-sol (medium)
// A big horseshoe magnet power-up standing upright facing -y: a U shape 32 tall, 30 wide, 6 thick, red on the curved body with the two tips silver-white (6 tall each) pointing down, a lighter red highlight on top; floating with the tips at z 4.
part("iman", [24, 24, 20]);
const cx = 23.5;
const outerRx = 15;
const innerRx = 8.5;
for (let x = 9; x <= 38; x++) {
const dx = x - cx;
const outerTop = 18 + 13.5 * Math.sqrt(Math.max(0, 1 - (dx / outerRx) ** 2));
const innerTop = Math.abs(dx) < innerRx
? 18 + 8 * Math.sqrt(1 - (dx / innerRx) ** 2)
: 18;
for (let z = 0; z <= 31; z++) {
const leg = (x <= 15 || x >= 32) && z <= 21;
const arch = z >= 18 && z <= outerTop && z > innerTop;
if (!leg && !arch) continue;
for (let y = 21; y <= 26; y++) {
const silverTip = leg && z <= 5;
let color;
if (silverTip) {
color = y === 21 ? "#f5fbff" : y === 26 ? "#bbcbd5" : "#e1eaf0";
if (z === 5 || (y === 21 && z >= 3)) color = "#ffffff";
if (z === 0 && y > 21) color = "#cdd9e1";
} else {
color = y === 21 ? "#f23848" : y === 26 ? "#bc2035" : "#df293b";
if (z >= outerTop - 1.5 && z >= 21) {
color = y === 26 ? "#e93849" : "#ff6670";
} else if (y === 21 && z >= outerTop - 3 && z >= 22) {
color = "#ff505d";
}
if (leg && z === 6) color = y === 21 ? "#ce2638" : "#b51e31";
}
set(x, y, z, color);
}
}
}
// Front-facing glints on the red uprights.
for (const x of [12, 35]) {
for (let z = 12; z <= 17; z++) set(x, 21, z, "#ff7179");
}
animate("iman", { type: "spin", axis: "z", speed: -2 });
animate("iman", { type: "bob", axis: "z", amplitude: 1.5 });import { draw } from "./assets/voxel";
import { nivelIman } from "./assets/nivel-iman";
// En cada cuadro: parado sobre (x, y), el centro de su base.
draw(ctx, nivelIman, 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-iman
# Con las herramientas de Fogón (conector)
add_assets({ slug: "<tu-juego>", ids: ["nivel-iman"] })
# Queda en client/assets/nivel-iman.ts
# https://fogon.page/object/nivel-iman