← Piratas y marObjeto 3Dfogon/red-de-pesca
Red de pesca
Arrastrá para girarlo// «Red de pesca» · gpt-6-sol (medium)
// A fishing net hung between two wooden poles: a grid of tan rope with a few round cork floats and a couple of small fish caught in it, a little pile of net on the ground.
const wood = "#986037";
const woodLight = "#be8150";
const woodDark = "#704027";
const rope = "#d8ad70";
const ropeLight = "#f1ce92";
const ropeDark = "#ae7845";
// Two stout, weathered poles.
for (const x of [6, 40]) {
box(x, 24, 0, x + 3, 27, 33, wood);
box(x, 24, 2, x, 24, 31, woodLight);
box(x + 3, 25, 1, x + 3, 26, 31, woodDark);
for (let i = 0; i < 19; i++) {
const z = 3 + Math.floor(rand() * 28);
set(x + Math.floor(rand() * 3), 24, z,
rand() < 0.55 ? woodLight : woodDark);
}
box(x - 1, 23, 0, x + 4, 28, 2, woodDark);
box(x, 24, 3, x + 3, 27, 4, woodLight);
box(x, 24, 31, x + 3, 27, 32, woodDark);
box(x + 1, 25, 33, x + 2, 26, 35, woodLight);
box(x, 24, 34, x + 3, 27, 34, wood);
}
// The net sags between its supports.
function edges(x) {
const center = 1 - Math.pow(Math.abs(x - 24) / 15, 1.35);
return {
top: 32 - 5 * center,
bottom: 11 - 5 * center
};
}
function netZ(x, row) {
const e = edges(x);
return Math.round(e.bottom + (e.top - e.bottom) * row / 6);
}
// Horizontal strands, with a brighter upper edge.
for (let row = 0; row <= 6; row++) {
for (let x = 9; x < 39; x++) {
line(x, 23, netZ(x, row), x + 1, 23, netZ(x + 1, row),
0, row === 6 ? ropeLight : rope);
}
}
// Vertical strands and little knots at the crossings.
for (let x = 9; x <= 39; x += 3) {
for (let row = 0; row < 6; row++) {
line(x, 23, netZ(x, row), x, 23, netZ(x, row + 1),
0, rope);
}
for (let row = 0; row <= 6; row++) {
set(x, 22, netZ(x, row), row % 2 ? ropeDark : ropeLight);
}
}
// Thick binding cords around the poles.
for (const x of [9, 40]) {
for (const z of [11, 30]) {
box(x - 1, 23, z, x + 1, 28, z, ropeDark);
box(x - 1, 23, z + 1, x + 1, 28, z + 1, ropeLight);
}
}
line(9, 23, 31, 11, 23, netZ(11, 6), 0, ropeDark);
line(39, 23, netZ(39, 6), 41, 23, 31, 0, ropeDark);
// Round cork floats along the top cord.
for (const x of [11, 18, 25, 32, 38]) {
const z = netZ(x, 6);
sphere(x, 21, z + 1, 1.7, "#cf8951");
set(x, 19, z + 1, "#f3c47b");
set(x, 20, z + 2, "#ffdda0");
set(x, 21, z - 1, ropeDark);
}
// Two brightly colored fish caught against the front of the mesh.
function fish(cx, cz, body, highlight, fin) {
ellipsoid(cx, 20, cz, 3, 1.5, 2, body);
line(cx - 2, 20, cz, cx - 5, 20, cz + 2, 1, fin);
line(cx - 2, 20, cz, cx - 5, 20, cz - 2, 1, fin);
line(cx - 1, 20, cz + 1, cx, 20, cz + 3, 0, fin);
line(cx, 20, cz - 1, cx + 1, 20, cz - 3, 0, fin);
line(cx - 1, 18, cz - 1, cx + 2, 18, cz - 1, 0, highlight);
set(cx + 2, 18, cz + 1, "#fff5dc");
set(cx + 2, 17, cz + 1, "#202a30");
set(cx + 1, 18, cz - 1, fin);
}
fish(18, 16, "#41bcb2", "#8ae3c5", "#248c92");
fish(33, 20, "#f18a60", "#ffd086", "#c95750");
// A loose, tangled heap of net on the sand in front.
for (let loop = 0; loop < 9; loop++) {
const cx = 16 + (loop % 5) * 3 + rand() * 2;
const cy = 16 + Math.floor(loop / 5) * 3 + rand() * 2;
const cz = Math.floor(loop / 4);
const rx = 2 + rand() * 2;
const ry = 1.5 + rand();
let previous = null;
for (let i = 0; i <= 16; i++) {
const a = i * Math.PI * 2 / 16;
const point = [
cx + Math.cos(a) * rx,
cy + Math.sin(a) * ry,
cz + Math.round(Math.sin(a * 2) * 0.6)
];
if (previous) {
line(...previous, ...point, 0,
loop % 3 === 0 ? ropeLight : rope);
}
previous = point;
}
}
line(21, 23, 6, 22, 19, 2, 0, rope);
line(28, 23, 6, 29, 18, 2, 0, ropeDark);import { draw } from "./assets/voxel";
import { redDePesca } from "./assets/red-de-pesca";
// En cada cuadro: parado sobre (x, y), el centro de su base.
draw(ctx, redDePesca, 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 red-de-pesca
# Con las herramientas de Fogón (conector)
add_assets({ slug: "<tu-juego>", ids: ["red-de-pesca"] })
# Queda en client/assets/red-de-pesca.ts
# https://fogon.page/object/red-de-pesca