← NaturalezaObjeto 3Dfogon/madriguera
Madriguera
Arrastrá para girarlo// «Madriguera» · gpt-6-sol (medium)
// A small grassy hill with a round dark burrow entrance in the front, a few pebbles and a carrot lying near the hole.
// A grassy, storybook burrow hill.
const cx = 24, cy = 25;
function hillTop(x, y) {
const d = Math.sqrt(((x - cx) / 19) ** 2 + ((y - cy) / 16) ** 2);
if (d > 1) return -1;
return Math.floor(2 + 14 * (1 - Math.pow(d, 1.55)));
}
// Solid, gently rounded hill with a thick grassy cap.
for (let x = 5; x <= 43; x++) {
for (let y = 9; y <= 41; y++) {
const top = hillTop(x, y);
if (top < 0) continue;
for (let z = 0; z <= top; z++) {
let color;
if (z === top) {
color = rand() < 0.12 ? "#a5e75c" : rand() < 0.22 ? "#75c93d" : "#8ddb48";
} else if (z >= top - 2) {
color = rand() < 0.16 ? "#69b53b" : "#79c940";
} else {
color = rand() < 0.12 ? "#93643d" : z < 3 ? "#805436" : "#a27146";
}
set(x, y, z, color);
}
}
}
// Carve a short, round tunnel into the front slope.
for (let y = 8; y <= 18; y++) {
for (let x = 18; x <= 30; x++) {
for (let z = 0; z <= 10; z++) {
const q = ((x - 24) / 4.4) ** 2 + ((z - 4.1) / 4.5) ** 2;
if (q <= 1) set(x, y, z, null);
}
}
}
// Deep shaded back wall and earthen tunnel floor.
for (let x = 19; x <= 29; x++) {
for (let z = 0; z <= 9; z++) {
const q = ((x - 24) / 4.4) ** 2 + ((z - 4.1) / 4.5) ** 2;
if (q <= 1) {
set(x, 19, z, q > 0.76 ? "#493524" : "#211d1a");
if (z === 0) {
for (let y = 11; y <= 18; y++) set(x, y, 0, "#59412b");
}
}
}
}
// Chunky earth-and-stone edging makes the entrance readable from the front.
for (let x = 18; x <= 30; x++) {
for (let z = 0; z <= 10; z++) {
const q = ((x - 24) / 5.15) ** 2 + ((z - 4.1) / 5.25) ** 2;
if (q > 0.66 && q <= 1.17) {
const shade = z >= 7 ? "#b78956" : "#86603c";
set(x, 13, z, rand() < 0.22 ? "#a77a4c" : shade);
if (z >= 2 && q > 0.83) set(x, 14, z, "#755337");
}
}
}
for (let x = 20; x <= 28; x++) {
if (Math.abs(x - 24) <= 3) {
set(x, 14, 10, "#73bf3d");
set(x, 15, 10, "#91dc4b");
}
}
// Small, soft grey pebbles around the doorway.
function pebble(x, y, size) {
ellipsoid(x, y, 1, size, size - 0.2, 1.2, "#929995");
set(x, y, 2, "#c8cfca");
set(x - 1, y, 1, "#adb6ad");
if (size > 2) set(x, y + 1, 2, "#83a66d");
}
pebble(14, 8, 2.2);
pebble(17, 10, 1.5);
pebble(31, 9, 1.5);
pebble(38, 12, 1.7);
// A carrot lies beside the entrance: leafy end at the left, pointed tip at the right.
for (let x = 34; x <= 42; x++) {
const t = (x - 34) / 8;
const r = 2.4 * (1 - t) + 0.15;
for (let y = 5; y <= 11; y++) {
for (let z = 0; z <= 4; z++) {
if (((y - 8) / r) ** 2 + ((z - 1.7) / 1.65) ** 2 <= 1) {
set(x, y, z, z >= 2 ? "#ffa338" : "#e87525");
}
}
}
}
set(36, 7, 3, "#dc6f24");
set(39, 8, 2, "#d96b20");
line(33, 8, 2, 29, 7, 4, 1, "#53b43e");
line(33, 8, 2, 30, 10, 5, 1, "#68c947");
line(33, 8, 2, 32, 6, 6, 1, "#78d64b");
set(29, 7, 4, "#82db55");
set(30, 10, 5, "#92e35a");
// Tiny upright grass tufts and cheerful flowers on the hillside.
function tuft(x, y) {
const h = hillTop(x, y);
if (h < 2) return;
line(x, y, h, x, y, h + 2, 0, "#5caf37");
set(x - 1, y, h + 1, "#83d84b");
set(x + 1, y, h + 1, "#a0e35a");
}
[[11, 23], [14, 33], [18, 18], [30, 33], [36, 26], [38, 19], [27, 38], [9, 27]]
.forEach(([x, y]) => tuft(x, y));
function flower(x, y, petal) {
const h = hillTop(x, y);
if (h < 3) return;
box(x, y, h + 1, x, y, h + 3, "#55ae38");
set(x - 1, y, h + 3, petal);
set(x + 1, y, h + 3, petal);
set(x, y - 1, h + 3, petal);
set(x, y + 1, h + 3, petal);
set(x, y, h + 4, petal);
set(x, y, h + 3, "#ffdb51");
}
flower(13, 28, "#fff2dc");
flower(33, 31, "#ff8fba");
flower(22, 36, "#f8efb2");import { draw } from "./assets/voxel";
import { madriguera } from "./assets/madriguera";
// En cada cuadro: parado sobre (x, y), el centro de su base.
draw(ctx, madriguera, 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 madriguera
# Con las herramientas de Fogón (conector)
add_assets({ slug: "<tu-juego>", ids: ["madriguera"] })
# Queda en client/assets/madriguera.ts
# https://fogon.page/object/madriguera