← Pirates and sea3D assetfogon/cuerdas-y-poleas
Cuerdas y poleas
Drag to turn it// «Cuerdas y poleas» · gpt-6-sol (medium)
// A ship rigging piece: a wooden post with two wooden pulleys and thick tan ropes going up and down, with a coiled rope at the foot.
const wood = "#a96532";
const woodLight = "#cf8845";
const woodDark = "#754021";
const rope = "#c99550";
const ropeLight = "#f4ce86";
const ropeDark = "#936331";
// Upright post, with a broad foot and a chunky crossbeam.
box(19, 22, 0, 29, 31, 2, woodDark);
box(21, 24, 2, 27, 29, 41, wood);
box(21, 24, 2, 21, 29, 40, woodLight);
box(27, 24, 2, 27, 29, 40, woodDark);
box(22, 24, 3, 26, 24, 40, woodLight);
box(20, 23, 39, 28, 30, 42, woodDark);
box(21, 23, 41, 27, 29, 42, woodLight);
box(9, 24, 35, 40, 28, 39, wood);
box(9, 24, 35, 40, 28, 35, woodDark);
box(9, 24, 39, 40, 28, 39, woodLight);
box(9, 24, 36, 40, 24, 38, woodLight);
box(9, 24, 35, 10, 29, 39, woodDark);
box(39, 24, 35, 40, 29, 39, woodDark);
// Little plank seams and weathered streaks.
for (const z of [10, 21, 32]) {
box(22, 23, z, 26, 23, z, woodDark);
box(23, 23, z + 1, 25, 23, z + 1, woodLight);
}
for (let i = 0; i < 32; i++) {
const x = 22 + Math.floor(rand() * 5);
const z = 4 + Math.floor(rand() * 34);
set(x, 23, z, rand() < 0.55 ? "#dc9953" : "#925027");
}
for (const x of [14, 24, 34]) {
box(x, 23, 36, x, 23, 38, woodDark);
set(x, 22, 37, "#f0be61");
}
// Two projecting wooden brackets and their pulley wheels.
function pulley(cx) {
box(cx - 2, 22, 30, cx + 2, 25, 33, woodDark);
box(cx - 1, 22, 32, cx + 1, 25, 33, woodLight);
for (let y = 18; y <= 22; y++) {
for (let dx = -4; dx <= 4; dx++) {
for (let dz = -4; dz <= 4; dz++) {
if (dx * dx + dz * dz <= 17) {
set(cx + dx, y, 29 + dz, y === 19 || y === 20 ? woodDark : wood);
}
}
}
}
// Raised front rim, inset face, and a bright axle pin.
for (let dx = -4; dx <= 4; dx++) {
for (let dz = -4; dz <= 4; dz++) {
const d = dx * dx + dz * dz;
if (d <= 17 && d >= 9) set(cx + dx, 17, 29 + dz, woodDark);
if (d < 9) set(cx + dx, 17, 29 + dz, woodLight);
}
}
line(cx - 2, 16, 29, cx + 2, 16, 29, 0, wood);
line(cx, 16, 27, cx, 16, 31, 0, wood);
set(cx, 15, 29, "#f0bc57");
set(cx, 15, 30, "#ffe09a");
// A thick rope travels up one side, over the sheave, and down the other.
const left = cx - 5, right = cx + 5;
line(left, 16, 29, left, 16, 44, 1.25, ropeDark);
line(left, 15, 30, left, 15, 43, 0, ropeLight);
line(right, 16, 7, right, 16, 29, 1.25, ropeDark);
line(right, 15, 8, right, 15, 28, 0, ropeLight);
for (let i = 0; i < 16; i++) {
const a = Math.PI * i / 15;
const b = Math.PI * (i + 1) / 15;
line(cx + 5 * Math.cos(a), 16, 29 + 5 * Math.sin(a),
cx + 5 * Math.cos(b), 16, 29 + 5 * Math.sin(b),
1.2, ropeDark);
line(cx + 5 * Math.cos(a), 15, 29 + 5 * Math.sin(a),
cx + 5 * Math.cos(b), 15, 29 + 5 * Math.sin(b),
0, ropeLight);
}
for (const z of [12, 18, 24, 39]) {
set(left, 14, z, rope);
set(right, 14, z, rope);
}
}
pulley(15);
pulley(34);
// Loose ends lead into a generous coil at the foot of the post.
line(20, 16, 8, 19, 16, 4, 1.2, ropeDark);
line(39, 16, 7, 33, 16, 3, 1.2, ropeDark);
line(39, 15, 7, 33, 15, 4, 0, ropeLight);
function coilRing(rx, ry, z) {
const steps = 48;
for (let i = 0; i < steps; i++) {
const a = 2 * Math.PI * i / steps;
const b = 2 * Math.PI * (i + 1) / steps;
line(24 + rx * Math.cos(a), 16 + ry * Math.sin(a), z,
24 + rx * Math.cos(b), 16 + ry * Math.sin(b), z,
1.1, ropeDark);
line(24 + rx * Math.cos(a), 16 + ry * Math.sin(a), z + 1,
24 + rx * Math.cos(b), 16 + ry * Math.sin(b), z + 1,
0, ropeLight);
}
}
coilRing(7, 4, 0);
coilRing(5, 3, 2);
coilRing(3, 2, 4);
line(28, 16, 5, 32, 15, 3, 1, rope);
line(19, 16, 4, 18, 14, 2, 1, ropeLight);import { draw } from "./assets/voxel";
import { cuerdasYPoleas } from "./assets/cuerdas-y-poleas";
// Every frame: standing on (x, y), the centre of its base.
draw(ctx, cuerdasYPoleas, x, y, { size: 64, angle: 0, t: performance.now() / 1000 });
// size: its longest side, in px
// angle: turn on the floor, in radians
// t: seconds; if it moves, that animates it# In a terminal, in the game's folder
fogon assets add cuerdas-y-poleas
# With Fogón's tools (connector)
add_assets({ slug: "<your-game>", ids: ["cuerdas-y-poleas"] })
# It lands in client/assets/cuerdas-y-poleas.ts
# https://fogon.page/object/cuerdas-y-poleas