← Piezas de nivel 2Objeto 3Dfogon/nivel-nube
Nube plataforma
Arrastrá para girarlo// «Nube plataforma» · gpt-6-sol (medium)
// A fluffy cloud platform: a cluster of overlapping white spheres forming a flat-topped cloud about 44 wide and 36 deep, 12 thick, floating with its top at z 26, pure white on top with light blue-grey shading underneath, and a cute face with two black dot eyes and a small smile on the front (-y).
part("nube", [24, 24, 20]);
// Flat-topped, overlapping cloud puffs: 44 wide and 36 deep.
const lobes = [
{ x: 24, y: 24, rx: 16, ry: 13, depth: 12 },
{ x: 10, y: 22, rx: 8, ry: 10, depth: 10 },
{ x: 38, y: 22, rx: 7, ry: 10, depth: 10 },
{ x: 17, y: 33, rx: 10, ry: 8, depth: 10 },
{ x: 32, y: 33, rx: 9, ry: 8, depth: 10 },
{ x: 24, y: 13, rx: 12, ry: 7, depth: 10 }
];
for (let x = 2; x <= 45; x++) {
for (let y = 6; y <= 41; y++) {
let bottom = 27;
for (const l of lobes) {
const q = ((x - l.x) / l.rx) ** 2 + ((y - l.y) / l.ry) ** 2;
if (q <= 1) {
bottom = Math.min(bottom, 26 - Math.round(2 + l.depth * Math.sqrt(1 - q)));
}
}
if (bottom > 26) continue;
for (let z = bottom; z <= 26; z++) {
let color = "#ffffff";
if (z <= 17) color = "#b9d2e0";
else if (z <= 20) color = "#d2e3ec";
else if (z <= 23) color = "#ecf5fa";
else if (z <= 25) color = "#f8fcff";
set(x, y, z, color);
}
}
}
// A rounded cloud puff hangs beneath the platform and reaches z = 0.
ellipsoid(24, 27, 13, 9, 8, 7, "#c9deea");
ellipsoid(24, 27, 6, 6, 6, 6, "#b9d2e0");
function faceBlock(x, z, color) {
for (let y = 6; y <= 41; y++) {
if (get(x, y, z)) {
set(x, y - 1, z, color);
return;
}
}
}
// Dot eyes and a little smile on the front.
for (const x of [19, 20, 28, 29]) {
for (const z of [20, 21]) faceBlock(x, z, "#182c3c");
}
faceBlock(22, 18, "#273d4b");
faceBlock(23, 17, "#273d4b");
faceBlock(24, 17, "#273d4b");
faceBlock(25, 17, "#273d4b");
faceBlock(26, 18, "#273d4b");
animate("nube", { type: "bob", axis: "z", amplitude: 2, speed: 1 });import { draw } from "./assets/voxel";
import { nivelNube } from "./assets/nivel-nube";
// En cada cuadro: parado sobre (x, y), el centro de su base.
draw(ctx, nivelNube, 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-nube
# Con las herramientas de Fogón (conector)
add_assets({ slug: "<tu-juego>", ids: ["nivel-nube"] })
# Queda en client/assets/nivel-nube.ts
# https://fogon.page/object/nivel-nube