← Piezas de nivel 2Objeto 3Dfogon/nivel-vida-extra
Vida extra
Arrastrá para girarlo// «Vida extra» · gpt-6-sol (medium)
// An extra-life power-up: a green mushroom like a classic 1-up, a half-sphere cap radius 16 bright green with big white round spots, on a cream stem with two black oval eyes; a white +1 floating above it.
part("vida", [24, 24, 0]);
// Chunky cream stem with a flat base.
for (let z = 0; z <= 19; z++) {
for (let y = 16; y <= 32; y++) {
for (let x = 16; x <= 32; x++) {
const d = (x - 24) ** 2 + (y - 24) ** 2;
if (d > 64) continue;
let color = "#f7e7bd";
if (x >= 29 || y >= 29) color = "#e8d3a8";
if (y <= 19 && x < 28) color = "#fff1d2";
if (z <= 2) color = "#e8d3a8";
set(x, y, z, color);
}
}
}
// Two tall, oval eyes on the front of the stem.
for (const x of [20, 28]) {
ellipsoid(x, 15.8, 11, 1.35, 1.5, 3.1, "#17201d");
set(x - 1, 14, 13, "#46504a");
}
// Darker green underside and crisp lower rim.
for (let y = 8; y <= 40; y++) {
for (let x = 8; x <= 40; x++) {
const d = (x - 24) ** 2 + (y - 24) ** 2;
if (d <= 15 ** 2) set(x, y, 18, "#218c35");
if (d <= 16 ** 2) set(x, y, 19, d > 14 ** 2 ? "#27a83d" : "#36bb47");
}
}
// White spots follow the curved surface rather than sitting flat on it.
const spots = [
[-0.51, -0.75, 0.43, 0.935],
[ 0.51, -0.75, 0.43, 0.935],
[ 0.00, -0.30, 0.95, 0.950],
[-0.91, 0.05, 0.41, 0.958],
[ 0.91, 0.05, 0.41, 0.958],
[ 0.00, 0.72, 0.69, 0.950]
];
for (let z = 20; z <= 34; z++) {
for (let y = 8; y <= 40; y++) {
for (let x = 8; x <= 40; x++) {
const dx = x - 24, dy = y - 24, dz = z - 19;
const d2 = dx * dx + dy * dy + dz * dz;
if (d2 > 16 ** 2) continue;
let color = dz >= 10 ? "#47d854" : "#34c94a";
if (dx > 8 || dy > 8) color = dz >= 10 ? "#39c94b" : "#27b640";
if (d2 >= 14.2 ** 2) {
const len = Math.sqrt(d2);
for (const [sx, sy, sz, cutoff] of spots) {
const dot = (dx * sx + dy * sy + dz * sz) / len;
if (dot > cutoff) {
color = dot < cutoff + 0.012 ? "#eaf7e8" : "#ffffff";
break;
}
}
}
set(x, y, z, color);
}
}
}
// Floating, thick white "+1", with a soft grey back edge.
function textBox(x0, z0, x1, z1) {
box(x0 + 1, 23, z0, x1 + 1, 23, z1, "#cbded4");
box(x0, 20, z0, x1, 22, z1, "#ffffff");
}
textBox(18, 38, 20, 45);
textBox(15, 41, 23, 43);
textBox(28, 38, 30, 45);
textBox(26, 42, 27, 43);
textBox(26, 38, 33, 39);
animate("vida", { type: "bob", axis: "z", speed: 2, amplitude: 1.5 });import { draw } from "./assets/voxel";
import { nivelVidaExtra } from "./assets/nivel-vida-extra";
// En cada cuadro: parado sobre (x, y), el centro de su base.
draw(ctx, nivelVidaExtra, 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-vida-extra
# Con las herramientas de Fogón (conector)
add_assets({ slug: "<tu-juego>", ids: ["nivel-vida-extra"] })
# Queda en client/assets/nivel-vida-extra.ts
# https://fogon.page/object/nivel-vida-extra