← AnimalesObjeto 3Dfogon/hormiga
Hormiga
Arrastrá para girarlo// «Hormiga» · gpt-6-sol (medium)
// A cartoon ant, horizontal along y, head at the front (-y): three round segments (head, thorax and a big abdomen) in dark reddish brown, two bent antennae, big eyes, small mandibles and six thin bent legs. It carries a green leaf over its head.
// Rounded body: head at the front (-y), thorax in the middle, abdomen behind.
ellipsoid(24, 34, 19, 9, 10, 8, "#692b25");
ellipsoid(24, 24, 17, 6, 6, 6, "#763126");
ellipsoid(24, 13, 19, 8, 8, 8, "#80382b");
// Warm upper surfaces and a little toy-like mottling.
forEach((x, y, z, color) => {
if (color === "#692b25") {
if (z >= 23) set(x, y, z, rand() < 0.12 ? "#9b4832" : "#84382a");
else if (rand() < 0.035) set(x, y, z, "#783026");
} else if (color === "#763126") {
if (z >= 19) set(x, y, z, "#91402d");
} else if (color === "#80382b") {
if (z >= 21) set(x, y, z, rand() < 0.09 ? "#b45a3b" : "#994632");
else if (z < 15) set(x, y, z, "#702c25");
}
});
// Broad, simple glints on the shiny shell.
ellipsoid(20, 30, 25, 2, 3, 1, "#b35a3b");
ellipsoid(20, 10, 25, 2, 2, 1, "#b65b3d");
// Big black dot eyes, facing the viewer.
sphere(19, 6, 21, 2, "#231b19");
sphere(29, 6, 21, 2, "#231b19");
set(18, 4, 22, "#fff2df");
set(28, 4, 22, "#fff2df");
// Two little curved mandibles.
for (const side of [-1, 1]) {
line(24 + side * 4, 6, 14, 24 + side * 4, 3, 12, 1, "#54231f");
line(24 + side * 4, 3, 12, 24 + side * 2, 2, 11, 1, "#713025");
set(24 + side * 2, 2, 11, "#9c4931");
// Bent antennae rise beside, rather than through, the leaf.
line(24 + side * 5, 9, 26, 24 + side * 7, 7, 31, 1, "#682920");
line(24 + side * 7, 7, 31, 24 + side * 10, 5, 33, 1, "#803628");
sphere(24 + side * 10, 5, 33, 1, "#a34c32");
}
// A short stem supports the oversized leaf above the head.
line(24, 13, 27, 24, 18, 34, 1, "#49752d");
line(24, 18, 34, 24, 23, 38, 1, "#578a34");
// Pointed oval leaf, slightly arched and thick enough to read from the side.
for (let y = 2; y <= 28; y++) {
const t = (y - 2) / 26;
const width = Math.max(0, Math.sin(Math.PI * t)) * 10;
const z = Math.round(37 + 3 * Math.sin(Math.PI * t) + t);
for (let x = Math.ceil(24 - width); x <= Math.floor(24 + width); x++) {
const edge = Math.abs(x - 24) > width - 1.5;
set(x, y, z - 1, "#376c30");
set(x, y, z, edge ? "#397d35" : rand() < 0.13 ? "#6dbb43" : "#54a53a");
}
set(24, y, z + 1, "#acd763");
if (y > 5 && y < 26 && y % 4 === 0) {
const reach = Math.floor(width * 0.8);
for (const side of [-1, 1]) {
line(24, y, z + 1, 24 + side * reach, y + 2, z + 1, 0, "#8cc954");
}
}
}
// Three legs on each side. Alternating tripods swing in opposite phases.
function leg(side, bodyY, kneeY, footY) {
const hipX = 24 + side * 5;
const kneeX = 24 + side * 12;
const footX = 24 + side * 20;
line(hipX, bodyY, 16, kneeX, kneeY, 10, 1, "#713027");
sphere(kneeX, kneeY, 10, 1.5, "#9b4730");
line(kneeX, kneeY, 10, footX - side * 1, footY, 2, 1, "#713027");
line(footX - side * 1, footY, 2, footX, footY - 1, 1, 1, "#8e3e2d");
sphere(footX, footY - 1, 1, 1.2, "#a64c32");
}
part("tripodA", [24, 24, 16]);
leg(-1, 19, 15, 11); // front-left
leg( 1, 24, 25, 26); // middle-right
leg(-1, 31, 36, 41); // rear-left
animate("tripodA", { type: "swing", axis: "x", speed: 6, amplitude: 0.3 });
part("tripodB", [24, 24, 16]);
leg( 1, 19, 15, 11); // front-right
leg(-1, 24, 25, 26); // middle-left
leg( 1, 31, 36, 41); // rear-right
animate("tripodB", { type: "swing", axis: "x", speed: -6, amplitude: 0.3 });import { draw } from "./assets/voxel";
import { hormiga } from "./assets/hormiga";
// En cada cuadro: parado sobre (x, y), el centro de su base.
draw(ctx, hormiga, 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 hormiga
# Con las herramientas de Fogón (conector)
add_assets({ slug: "<tu-juego>", ids: ["hormiga"] })
# Queda en client/assets/hormiga.ts
# https://fogon.page/object/hormiga