← NaturalezaObjeto 3Dfogon/colina-de-pasto
Lomita
Arrastrá para girarlo// «Lomita» · gpt-6-sol (medium)
// A small rounded grassy hill covering most of the grid: green grass on top, brown dirt visible at the sides, a few flowers.
const cx = 24, cy = 24;
const heights = new Map();
const key = (x, y) => `${x},${y}`;
function hillHeight(x, y) {
const dx = x - cx, dy = y - cy;
const angle = Math.atan2(dy, dx);
const wobble = 1 + 0.025 * Math.sin(5 * angle + 0.5)
+ 0.018 * Math.sin(9 * angle - 1.2);
const r = Math.hypot(dx / 21.5, dy / 20.5) / wobble;
if (r > 1) return -1;
const rise = Math.pow(Math.max(0, 1 - r * r), 1.35);
const gentleRipple = 0.35 * Math.sin(x * 0.28) * Math.cos(y * 0.31);
return Math.max(3, Math.round(3 + 10 * rise + gentleRipple));
}
// Solid earth, capped with a thick, bright grassy skin.
for (let x = 2; x <= 46; x++) {
for (let y = 2; y <= 46; y++) {
const h = hillHeight(x, y);
if (h < 0) continue;
heights.set(key(x, y), h);
for (let z = 0; z <= h; z++) {
let color;
if (z >= h - 1) {
const n = rand();
color = z === h
? (n < 0.13 ? "#a0e85d" : n < 0.40 ? "#86d94a" : "#72c83f")
: (n < 0.25 ? "#68bd3c" : "#58ad36");
} else {
const n = rand();
color = z >= h - 4
? (n < 0.18 ? "#b77c45" : n < 0.77 ? "#a86a3a" : "#95582f")
: (n < 0.20 ? "#995d35" : n < 0.80 ? "#87502e" : "#754429");
}
set(x, y, z, color);
}
}
}
function surface(x, y) {
return heights.get(key(x, y));
}
// Little tufts add texture without obscuring the rounded silhouette.
for (let i = 0; i < 48; i++) {
const x = 7 + Math.floor(rand() * 35);
const y = 7 + Math.floor(rand() * 35);
const h = surface(x, y);
if (h === undefined || rand() < 0.28) continue;
set(x, y, h + 1, rand() < 0.5 ? "#59b939" : "#8bdf4c");
if (rand() < 0.35) set(x, y, h + 2, "#86dc49");
if (surface(x + 1, y) !== undefined && rand() < 0.55) {
set(x + 1, y, surface(x + 1, y) + 1, "#a0e75c");
}
}
// A few toy-like flowers, each with a green stem and a contrasting center.
const flowers = [
[14, 12, "#ff81a5"], [29, 11, "#fff3de"],
[38, 19, "#b590f5"], [10, 27, "#ffad66"],
[18, 21, "#fff2e3"], [33, 27, "#ff80a5"],
[24, 34, "#aa90f3"], [39, 34, "#ffe7ed"],
[13, 37, "#ffb26c"]
];
for (const [x, y, petals] of flowers) {
const h = surface(x, y);
if (h === undefined) continue;
set(x, y, h + 1, "#3c9d39");
set(x, y, h + 2, "#48a83b");
const bloom = h + 3;
set(x - 1, y, bloom, petals);
set(x + 1, y, bloom, petals);
set(x, y - 1, bloom, petals);
set(x, y + 1, bloom, petals);
set(x, y, bloom, "#ffdd50");
}import { draw } from "./assets/voxel";
import { colinaDePasto } from "./assets/colina-de-pasto";
// En cada cuadro: parado sobre (x, y), el centro de su base.
draw(ctx, colinaDePasto, 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 colina-de-pasto
# Con las herramientas de Fogón (conector)
add_assets({ slug: "<tu-juego>", ids: ["colina-de-pasto"] })
# Queda en client/assets/colina-de-pasto.ts
# https://fogon.page/object/colina-de-pasto