← Pirates and sea3D assetfogon/canon-naval
Cañón naval
Drag to turn it// «Cañón naval» · gpt-6-sol (medium)
// A black iron ship cannon on a low dark-wood gun carriage with four small wooden wheels, the barrel pointing toward -y with a thick muzzle ring, a coil of rope and a little fuse at the back.
const wood = "#754328";
const woodLight = "#a66a3a";
const woodDark = "#4c2d22";
const iron = "#252b32";
const ironLight = "#525d64";
const ironDark = "#12191e";
const brass = "#c99443";
// Low, sturdy gun carriage.
box(15, 11, 5, 19, 40, 10, wood);
box(29, 11, 5, 33, 40, 10, wood);
box(19, 13, 6, 29, 17, 9, woodDark);
box(19, 31, 6, 29, 39, 9, woodDark);
box(19, 36, 9, 29, 41, 11, wood);
// Lighter edges and separate plank lines.
for (const x of [15, 29]) {
box(x, 11, 10, x + 4, 40, 10, woodLight);
for (const y of [16, 23, 30, 37])
box(x, y, 6, x + 4, y, 9, woodDark);
}
for (const x of [20, 23, 26])
box(x, 37, 11, x, 41, 11, woodLight);
for (const y of [12, 39]) {
box(15, y, 7, 16, y + 1, 9, brass);
box(32, y, 7, 33, y + 1, 9, brass);
}
// Two axles and four chunky wooden wheels.
for (const wy of [15, 34]) {
cylinder(12, wy, 5, 2, 25, ironDark, "x");
for (const [start, face, hub] of [[10, 9, 8], [34, 38, 39]]) {
cylinder(start, wy, 5, 5, 4, woodDark, "x");
cylinder(face, wy, 5, 5, 1, woodLight, "x");
cylinder(face, wy, 5, 3, 1, woodDark, "x");
// Bright wooden rim and four broad spokes on the outward face.
for (let a = 0; a < Math.PI * 2; a += Math.PI / 16) {
set(face, wy + Math.round(4.5 * Math.cos(a)),
5 + Math.round(4.5 * Math.sin(a)), woodLight);
}
line(face, wy - 3, 5, face, wy + 3, 5, 0, woodLight);
line(face, wy, 2, face, wy, 8, 0, woodLight);
cylinder(hub, wy, 5, 1.5, 1, brass, "x");
set(hub, wy, 5, ironDark);
}
}
// Cradle and side brackets under the cannon.
box(19, 19, 10, 29, 29, 12, woodDark);
box(16, 22, 11, 19, 27, 15, brass);
box(29, 22, 11, 32, 27, 15, brass);
box(17, 23, 12, 18, 26, 15, woodDark);
box(30, 23, 12, 31, 26, 15, woodDark);
// Cast-iron barrel, pointing toward the viewer (-y).
cylinder(24, 7, 17, 5, 21, iron, "y");
cylinder(24, 27, 17, 6, 8, iron, "y");
cylinder(24, 34, 17, 7, 4, ironDark, "y");
cylinder(24, 3, 17, 7, 4, iron, "y");
// Raised casting bands and thick muzzle lip.
for (const [y, r, h] of [[3, 7, 2], [9, 6, 2], [24, 6, 2], [32, 7, 2]]) {
cylinder(24, y, 17, r, h, ironDark, "y");
for (let x = 21; x <= 27; x++)
set(x, y, 17 + r - 1, ironLight);
}
// Sunlit top edges of the iron.
forEach((x, y, z, color) => {
if ((color === iron || color === ironDark) &&
y >= 3 && y <= 38 && z >= 20 &&
get(x, y, z + 1) === undefined && rand() < 0.55) {
set(x, y, z, ironLight);
}
});
// Recessed black bore, with a visible inner lip.
cylinder(24, 3, 17, 3, 8, "#080e12", "y");
cylinder(24, 3, 17, 2, 2, "#18232a", "y");
cylinder(24, 5, 17, 2, 1, "#090d11", "y");
for (let a = 0; a < Math.PI * 2; a += Math.PI / 12) {
set(24 + Math.round(4 * Math.cos(a)), 3,
17 + Math.round(4 * Math.sin(a)), ironLight);
}
// Breech knob and trunnion ends.
sphere(24, 39, 17, 3, ironDark);
sphere(24, 41, 17, 1.5, ironLight);
cylinder(14, 24, 17, 2, 5, ironDark, "x");
cylinder(30, 24, 17, 2, 5, ironDark, "x");
set(14, 24, 17, ironLight);
set(34, 24, 17, ironLight);
// A neatly coiled tan rope resting behind the gun.
for (let t = 0; t < Math.PI * 5; t += 0.085) {
const r = 3.3 - 0.17 * t;
const x = 23 + r * Math.cos(t);
const y = 39 + r * Math.sin(t);
sphere(x, y, 12.5, 0.8, t % 1.1 < 0.28 ? "#e7c58a" : "#cda36b");
}
line(26, 40, 12, 30, 41, 11, 0, "#e7c58a");
// Short unlit fuse emerging from the breech.
line(24, 36, 23, 24, 36, 25, 0, "#554338");
line(24, 36, 25, 25, 35, 26, 0, "#554338");
set(25, 35, 26, "#d6b587");import { draw } from "./assets/voxel";
import { canonNaval } from "./assets/canon-naval";
// Every frame: standing on (x, y), the centre of its base.
draw(ctx, canonNaval, 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 canon-naval
# With Fogón's tools (connector)
add_assets({ slug: "<your-game>", ids: ["canon-naval"] })
# It lands in client/assets/canon-naval.ts
# https://fogon.page/object/canon-naval