← ArmasObjeto 3Dfogon/arma-revolver
Revólver
Arrastrá para girarlo// «Revólver» · propio
// A silver western revolver with a big round cylinder, long barrel and a wooden grip.
const colors = () => {};
// ===== palette =====
const SIL = "#9aa3b2";
const SILL = "#ccd4e0";
const SILD = "#6a7284";
const SILX = "#454b5a";
const WOOD = "#8a5a2e";
const WOODL = "#b0773c";
const WOODD = "#5c3a1c";
const GOLD = "#d9a441";
const GOLDL = "#f2cd6b";
const GOLDD = "#a87a26";
const DARK = "#1e222a";
// ===== revolving cylinder (spins around its own axis) =====
part("drum", [19, 29, 4]);
cylinder(19, 29, 0, 7, 9, SIL);
cylinder(19, 29, 0, 7, 1, SILD);
cylinder(19, 29, 8, 7, 1, SILL);
for (let i = 0; i < 8; i++) {
const a = i * Math.PI / 4 + 0.39;
const px = Math.round(19 + 6.5 * Math.cos(a));
const py = Math.round(29 + 6.5 * Math.sin(a));
box(px, py, 2, px, py, 6, SILD);
}
for (let i = 0; i < 6; i++) {
const a = i * Math.PI / 3;
const px = 19 + 4.2 * Math.cos(a);
const py = 29 + 4.2 * Math.sin(a);
cylinder(px, py, 0, 1.9, 9, DARK);
}
cylinder(19, 29, 0, 1.2, 9, GOLDD);
animate("drum", { type: "spin", axis: "z", speed: 1.1 });
// ===== wooden grip =====
part("body");
for (let y = 8; y <= 22; y++) {
const x0 = Math.round(2 + (y - 8) * 9 / 14);
const x1 = x0 + 8;
box(x0, y, 1, x1, y, 7, WOOD);
box(x0, y, 1, x0, y, 7, WOODD);
box(x1, y, 1, x1, y, 7, WOODL);
if (y % 3 === 0) box(x0 + 2, y, 7, x1 - 2, y, 7, WOODD);
if (y % 3 === 1) box(x0 + 2, y, 7, x0 + 4, y, 7, WOODL);
}
// butt cap
box(2, 8, 1, 10, 8, 7, WOODD);
box(3, 7, 2, 10, 7, 6, WOODD);
// ===== rear frame / standing breech =====
box(6, 20, 1, 12, 39, 7, SIL);
box(6, 20, 1, 6, 39, 7, SILD);
box(12, 20, 1, 12, 39, 7, SILL);
set(9, 26, 7, GOLDD);
set(9, 33, 7, GOLDD);
// ===== top strap over the cylinder =====
box(6, 37, 1, 28, 39, 7, SIL);
box(6, 39, 1, 28, 39, 7, SILL);
box(6, 37, 1, 28, 37, 7, SILD);
// ===== long barrel =====
box(26, 31, 1, 45, 38, 7, SIL);
box(26, 31, 1, 45, 31, 7, SILD);
box(26, 38, 1, 45, 38, 7, SILL);
// top rib
box(27, 39, 3, 44, 39, 5, SILD);
// front sight
box(41, 40, 3, 43, 40, 5, GOLDL);
// ejector rod housing
box(26, 27, 3, 40, 30, 5, SILD);
box(26, 27, 3, 40, 27, 3, SILX);
box(40, 27, 3, 40, 30, 5, SILX);
// ===== muzzle crown & bore =====
for (let y = 31; y <= 38; y++) for (let z = 1; z <= 7; z++) set(45, y, z, SILL);
for (let y = 32; y <= 37; y++) {
for (let z = 2; z <= 6; z++) {
const dy = y - 34.5, dz = z - 4;
if (dy * dy + dz * dz <= 5.5) {
set(45, y, z, DARK);
set(44, y, z, DARK);
}
}
}
// ===== trigger guard =====
ellipsoid(23, 16, 4, 7, 7, 3.5, GOLD);
ellipsoid(23, 16, 4, 3.2, 4, 3.5, null);
box(17, 9, 3, 29, 9, 5, GOLDD);
// trigger
box(22, 17, 2, 23, 20, 6, SILX);
box(22, 19, 2, 23, 20, 6, SIL);
// ===== subtle silver grain / wear =====
for (let x = 6; x <= 45; x++) {
if (x >= 12 && x <= 26) continue;
for (let y = 20; y <= 39; y++) {
if (get(x, y, 7) === SIL && rand() < 0.16) set(x, y, 7, SILD);
if (get(x, y, 7) === SILL && rand() < 0.10) set(x, y, 7, SIL);
}
}
// ===== hammer (cocking swing) =====
part("hammer", [8, 39, 4]);
box(7, 39, 2, 10, 42, 6, SIL);
box(7, 39, 2, 7, 42, 6, SILD);
box(10, 41, 2, 10, 42, 6, SILL);
box(7, 42, 2, 10, 42, 6, SILL);
box(7, 40, 2, 7, 40, 6, GOLDD);
animate("hammer", { type: "swing", axis: "z", speed: 2.4, amplitude: 0.16 });import { draw } from "./assets/voxel";
import { armaRevolver } from "./assets/arma-revolver";
// En cada cuadro: parado sobre (x, y), el centro de su base.
draw(ctx, armaRevolver, 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 arma-revolver
# Con las herramientas de Fogón (conector)
add_assets({ slug: "<tu-juego>", ids: ["arma-revolver"] })
# Queda en client/assets/arma-revolver.ts
# https://fogon.page/object/arma-revolver