← Piezas de nivel 2Objeto 3Dfogon/nivel-mina
Mina
Arrastrá para girarlo// «Mina» · gpt-6-sol (medium)
// A landmine: a squat round dark olive green metal disc, radius 12 and 5 tall, centered on the floor, with a ring of rivets, a raised central pressure button, and a small blinking red light on top. Around it, a tiny ring of disturbed dirt on the floor.
const cx = 24, cy = 24;
// A thin, broken ring of freshly disturbed dirt.
for (let x = 6; x <= 42; x++) {
for (let y = 6; y <= 42; y++) {
const d = Math.hypot(x - cx, y - cy);
if (d >= 12.4 && d <= 17.2) {
const chance = d < 14.6 ? 0.76 : 0.34;
if (rand() < chance) {
set(x, y, 0, rand() < 0.22 ? "#a86d3c" : rand() < 0.48 ? "#825232" : "#945f38");
}
}
}
}
// Five-block-tall olive steel casing, with a beveled bottom and top.
const radii = [10.7, 11.7, 12, 12, 11.5];
for (let z = 0; z < 5; z++) {
for (let x = 12; x <= 36; x++) {
for (let y = 12; y <= 36; y++) {
const d = Math.hypot(x - cx, y - cy);
if (d > radii[z]) continue;
let color;
if (z === 0) color = "#343f22";
else if (z === 1) color = d > 10.7 ? "#45532b" : "#3d4927";
else if (z === 2) color = d > 11 ? "#526332" : "#48592c";
else if (z === 3) color = d > 11 ? "#354224" : "#526432";
else color = d > 10.2 ? "#354629" : "#64783c";
set(x, y, z, color);
}
}
}
// Crisp segmented rim around the top.
for (let x = 12; x <= 36; x++) {
for (let y = 12; y <= 36; y++) {
const d = Math.hypot(x - cx, y - cy);
if (d >= 9.7 && d <= 10.5) set(x, y, 4, "#889750");
}
}
// Twelve large, bright rivet heads.
for (let i = 0; i < 12; i++) {
const a = i * Math.PI / 6;
const x = Math.round(cx + Math.cos(a) * 9);
const y = Math.round(cy + Math.sin(a) * 9);
set(x, y, 5, "#a4aa74");
set(x, y, 6, "#d0cca0");
}
// Raised pressure-button collar.
for (let x = 18; x <= 30; x++) {
for (let y = 18; y <= 30; y++) {
const d = Math.hypot(x - cx, y - cy);
if (d <= 6) set(x, y, 5, d > 4.8 ? "#354424" : "#87944f");
if (d >= 4.4 && d <= 5.5) set(x, y, 6, "#adb875");
if (d <= 4.2) {
set(x, y, 6, "#536731");
set(x, y, 7, d > 3.2 ? "#81964c" : "#a8ba66");
}
}
}
// Small warning-light socket beside the button.
box(30, 19, 5, 32, 21, 5, "#303927");
box(30, 19, 6, 32, 21, 6, "#b8ad77");
// The red lens pulses independently.
part("luz", [31, 20, 7]);
box(30, 20, 7, 32, 20, 8, "#ff2020");
set(31, 19, 7, "#ff2020");
set(31, 21, 7, "#ff2020");
set(31, 20, 9, "#ff2020");
animate("luz", {
type: "colors",
palette: ["#ff2020", "#400808"],
pattern: "pulse",
glow: 1
});import { draw } from "./assets/voxel";
import { nivelMina } from "./assets/nivel-mina";
// En cada cuadro: parado sobre (x, y), el centro de su base.
draw(ctx, nivelMina, 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-mina
# Con las herramientas de Fogón (conector)
add_assets({ slug: "<tu-juego>", ids: ["nivel-mina"] })
# Queda en client/assets/nivel-mina.ts
# https://fogon.page/object/nivel-mina