← NaturalezaObjeto 3Dfogon/arbusto-con-flores
Arbusto con flores
Arrastrá para girarlo// «Arbusto con flores» · gpt-6-sol (medium)
// A low rounded green bush dotted with many small pink and white flowers on its surface.
// A low, lumpy bush with a broad, rounded silhouette.
ellipsoid(24, 24, 8, 17, 16, 8, "#48b94c");
ellipsoid(24, 24, 4, 17, 16, 4, "#318e3d");
const lobes = [
[11, 19, 7, 8, 8, 7],
[12, 32, 7, 8, 8, 7],
[36, 17, 8, 8, 8, 8],
[36, 32, 7, 8, 8, 7],
[22, 11, 7, 10, 7, 7],
[25, 37, 7, 10, 7, 7],
[22, 23, 11, 11, 10, 8]
];
for (const [x, y, z, rx, ry, rz] of lobes) {
ellipsoid(x, y, z, rx, ry, rz, "#48b94c");
}
// Sunlit tops, shaded undersides, and small leafy color variations.
forEach((x, y, z) => {
const n = rand();
let color;
if (z < 4) color = n < 0.22 ? "#287d39" : "#349442";
else if (z < 9) color = n < 0.14 ? "#399d43" : "#46ac49";
else if (z < 14) color = n < 0.18 ? "#6bd45c" : "#51c34e";
else color = n < 0.25 ? "#8ae374" : "#65d35a";
set(x, y, z, color);
});
const blossoms = [
{ petals: ["#ff91c3", "#ffb2d4"], center: "#ffe16b" },
{ petals: ["#fff8f2", "#ffe9f1"], center: "#ffd762" }
];
function topFlower(x, y, z, kind) {
const f = blossoms[kind];
set(x - 1, y, z + 1, f.petals[0]);
set(x + 1, y, z + 1, f.petals[1]);
set(x, y - 1, z + 1, f.petals[1]);
set(x, y + 1, z + 1, f.petals[0]);
set(x, y, z + 1, f.center);
set(x, y, z + 2, "#fff0a0");
}
const placed = [];
for (let attempt = 0; attempt < 550 && placed.length < 53; attempt++) {
const x = 6 + Math.floor(rand() * 37);
const y = 6 + Math.floor(rand() * 37);
let z = 21;
while (z >= 0 && !get(x, y, z)) z--;
if (z < 8) continue;
if (placed.some(([px, py]) => (px - x) ** 2 + (py - y) ** 2 < 12)) continue;
placed.push([x, y]);
topFlower(x, y, z, rand() < 0.55 ? 0 : 1);
}
// A few blossoms face the viewer along the front of the bush.
const frontFlowers = [];
for (let attempt = 0; attempt < 280 && frontFlowers.length < 15; attempt++) {
const x = 8 + Math.floor(rand() * 33);
const z = 5 + Math.floor(rand() * 8);
let y = 4;
while (y < 25 && !get(x, y, z)) y++;
if (y >= 25 || y < 6) continue;
if (frontFlowers.some(([px, pz]) => (px - x) ** 2 + (pz - z) ** 2 < 13)) continue;
frontFlowers.push([x, z]);
const f = blossoms[rand() < 0.55 ? 0 : 1];
set(x - 1, y - 1, z, f.petals[0]);
set(x + 1, y - 1, z, f.petals[1]);
set(x, y - 1, z - 1, f.petals[1]);
set(x, y - 1, z + 1, f.petals[0]);
set(x, y - 2, z, f.center);
}import { draw } from "./assets/voxel";
import { arbustoConFlores } from "./assets/arbusto-con-flores";
// En cada cuadro: parado sobre (x, y), el centro de su base.
draw(ctx, arbustoConFlores, 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 arbusto-con-flores
# Con las herramientas de Fogón (conector)
add_assets({ slug: "<tu-juego>", ids: ["arbusto-con-flores"] })
# Queda en client/assets/arbusto-con-flores.ts
# https://fogon.page/object/arbusto-con-flores