← Piezas de nivel 2Objeto 3Dfogon/nivel-nieve
Bloque de nieve
Arrastrá para girarlo// «Bloque de nieve» · gpt-6-sol (medium)
// A square ground tile that tiles seamlessly: a full 48x48 footprint (x 0..47, y 0..47), 8 blocks thick (z 0..7), a perfectly flat solid slab with straight vertical sides and no gaps. The top 3 layers (z 5..7) are bright white snow in 2-3 cool shades (white, very pale blue) with soft bumps of 1 block; the snow hangs 1-2 blocks down the sides in an uneven icing edge; below it, dark frozen brown dirt with a few pale blue frost specks (z 0..4).
// A full-footprint, eight-block-thick snow tile.
const dirt = ["#4b352f", "#563b32", "#604139"];
const snow = ["#ffffff", "#f3fbff", "#e5f5ff"];
for (let x = 0; x < 48; x++) {
for (let y = 0; y < 48; y++) {
for (let z = 0; z < 8; z++) {
if (z < 5) {
let shade = z < 2 ? 0 : z < 4 ? 1 : 2;
if (rand() < 0.045) shade = Math.max(0, shade - 1);
set(x, y, z, dirt[shade]);
} else {
set(x, y, z, z === 5 ? snow[2] : z === 6 ? snow[1] : snow[0]);
}
}
}
}
// Broad, low-contrast patches suggest soft one-block snow mounds
// without breaking the tile's flat, eight-block-high surface.
for (const [cx, cy, rx, ry] of [
[10, 12, 6, 4], [33, 9, 7, 5], [23, 27, 8, 5],
[8, 37, 5, 4], [39, 38, 5, 6]
]) {
for (let x = Math.max(1, cx - rx); x <= Math.min(46, cx + rx); x++) {
for (let y = Math.max(1, cy - ry); y <= Math.min(46, cy + ry); y++) {
const d = ((x - cx) / rx) ** 2 + ((y - cy) / ry) ** 2;
if (d < 0.7) set(x, y, 7, "#f3fbff");
else if (d < 1) set(x, y, 7, "#eaf7ff");
}
}
}
// An irregular icing edge descends one or two blocks down the sides.
// All blocks remain inside the exact 48×48 footprint.
for (let i = 0; i < 48; i++) {
for (let side = 0; side < 4; side++) {
const x = side < 2 ? i : (side === 2 ? 0 : 47);
const y = side < 2 ? (side === 0 ? 0 : 47) : i;
const wave = Math.sin(i * 0.47 + side * 1.8)
+ 0.55 * Math.sin(i * 1.13 + side * 2.4);
set(x, y, 4, wave > -0.55 ? snow[2] : dirt[2]);
if (wave > 0.95) set(x, y, 3, snow[2]);
if (wave > 1.45) set(x, y, 3, snow[1]);
set(x, y, 5, snow[1]);
}
}
// Sparse frost crystals on the exposed frozen dirt.
for (let side = 0; side < 4; side++) {
for (let i = 2; i < 46; i++) {
if (rand() < 0.13) {
const x = side < 2 ? i : (side === 2 ? 0 : 47);
const y = side < 2 ? (side === 0 ? 0 : 47) : i;
const z = 1 + Math.floor(rand() * 3);
if (get(x, y, z) !== snow[1] && get(x, y, z) !== snow[2])
set(x, y, z, "#a9c8d2");
}
}
}import { draw } from "./assets/voxel";
import { nivelNieve } from "./assets/nivel-nieve";
// En cada cuadro: parado sobre (x, y), el centro de su base.
draw(ctx, nivelNieve, 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-nieve
# Con las herramientas de Fogón (conector)
add_assets({ slug: "<tu-juego>", ids: ["nivel-nieve"] })
# Queda en client/assets/nivel-nieve.ts
# https://fogon.page/object/nivel-nieve