← Kit de nivelesObjeto 3Dfogon/nivel-pasto
Bloque de pasto
Arrastrá para girarlo// «Bloque de pasto» · 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 2 layers (z 6..7) are bright green grass with 2-3 shades of green in a light random pattern; the sides show a thin grass lip hanging 1 block down in an uneven edge, then warm brown dirt below (z 0..5) in two shades with a few small grey pebbles. On top, a few small grass tufts (1-2 blocks tall, lighter green) and two or three tiny flowers (yellow, white) scattered away from the edges.
const grass = ["#5bcf36", "#65d83d", "#70df45"];
const dirt = ["#aa6938", "#bb7840"];
const pebble = ["#b8b8ac", "#d0d0c3"];
// Solid, grid-aligned 48×48 slab.
for (let x = 0; x < 48; x++) {
for (let y = 0; y < 48; y++) {
for (let z = 0; z < 8; z++) {
if (z >= 6) {
const shade = rand();
set(x, y, z, grass[shade < 0.72 ? 0 : shade < 0.92 ? 1 : 2]);
} else {
set(x, y, z, rand() < 0.16 ? dirt[1] : dirt[0]);
}
}
}
}
// A thin, uneven grass lip on the four vertical sides.
for (let i = 0; i < 48; i++) {
if ((Math.floor(i / 3) * 7 + i) % 11 < 8) {
set(i, 0, 5, "#52bd32");
set(i, 47, 5, "#52bd32");
}
if ((Math.floor(i / 4) * 5 + i) % 12 < 9) {
set(0, i, 5, "#52bd32");
set(47, i, 5, "#52bd32");
}
}
// Sparse little pebbles embedded in the exposed dirt.
for (const [x, y, z, c] of [
[8, 0, 2, 0], [9, 0, 2, 1], [36, 0, 3, 0],
[14, 47, 1, 1], [39, 47, 3, 0], [40, 47, 3, 1],
[0, 11, 2, 0], [0, 34, 3, 1],
[47, 18, 1, 0], [47, 30, 3, 1]
]) set(x, y, z, pebble[c]);
// Short, chunky grass tufts, kept well away from the tile edges.
for (const [x, y] of [
[9, 11], [19, 9], [35, 12], [40, 22],
[12, 28], [20, 24], [31, 23], [9, 39],
[25, 39], [38, 38]
]) {
set(x, y, 8, "#80e952");
set(x, y, 9, "#a1f36b");
set(x + 1, y, 8, "#78e347");
set(x, y + 1, 8, "#8ceb57");
}
// Three tiny flowers with bright petals and contrasting centers.
function flower(x, y, petal, center) {
set(x, y, 8, "#51b936");
set(x, y, 9, center);
set(x - 1, y, 9, petal);
set(x + 1, y, 9, petal);
set(x, y - 1, 9, petal);
set(x, y + 1, 9, petal);
}
flower(15, 17, "#ffe65a", "#ef9d28");
flower(33, 32, "#fff9e8", "#ffd246");
flower(21, 34, "#fff4d3", "#f5bd36");import { draw } from "./assets/voxel";
import { nivelPasto } from "./assets/nivel-pasto";
// En cada cuadro: parado sobre (x, y), el centro de su base.
draw(ctx, nivelPasto, 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-pasto
# Con las herramientas de Fogón (conector)
add_assets({ slug: "<tu-juego>", ids: ["nivel-pasto"] })
# Queda en client/assets/nivel-pasto.ts
# https://fogon.page/object/nivel-pasto