← ArmasObjeto 3Dfogon/arma-pistola-dorada
Pistola dorada
Arrastrá para girarlo// «Pistola dorada» · propio
// ONE single golden pistol (just one gun) with a dark grip. It lies on its side like a gun dropped on a table: the side of the gun faces up (+z), the grip points sideways along +x.
const colors = () => {};
const GL = "#f9dd66", G = "#e7b92f", GD = "#bb8c1f", GX = "#8d6712";
const KL = "#4b392c", K = "#33261d", KD = "#221810";
const ST = "#33333d", SD = "#181820";
// ================= SLIDE =================
box(4, 11, 1, 38, 19, 5, G); // main slab
box(5, 12, 0, 37, 18, 0, GD); // bottom chamfer
box(5, 12, 6, 37, 18, 6, G); // top chamfer plate
// edge shading on the top plate (light from the gun's top side = -y)
for (let x = 5; x <= 37; x++) {
set(x, 12, 6, GL);
set(x, 18, 6, GD);
}
// bevel highlight / shadow along the long edges
for (let x = 4; x <= 38; x++) {
set(x, 11, 5, GL);
set(x, 19, 5, GX);
}
// ---- muzzle bore ----
for (let y = 10; y <= 20; y++) for (let z = 0; z <= 6; z++) {
const dy = (y - 15) / 2.3, dz = (z - 3) / 2.1;
const d = dy * dy + dz * dz;
if (d <= 1) {
if (get(4, y, z)) set(4, y, z, SD);
set(5, y, z, SD);
} else if (d <= 1.7 && get(4, y, z)) {
set(4, y, z, GX);
}
}
// ---- ejection port (recessed) ----
box(20, 13, 5, 27, 16, 6, SD);
for (let x = 19; x <= 28; x++) { set(x, 12, 6, GX); set(x, 17, 6, GX); }
// ---- slide serrations ----
for (let x = 29; x <= 34; x++) if (x % 2 === 0) {
for (let y = 13; y <= 17; y++) if (get(x, y, 6) === G) set(x, y, 6, GD);
}
// ---- sights (stick out of the gun's top side) ----
box(6, 9, 2, 8, 11, 4, GD);
box(35, 9, 2, 37, 11, 4, GD);
set(7, 9, 3, GL); set(36, 9, 3, GL);
// ================= FRAME / DUST COVER =================
box(15, 20, 1, 34, 21, 5, GD);
for (let x = 15; x <= 34; x++) { set(x, 20, 5, GX); set(x, 21, 5, GX); }
// ================= TRIGGER GUARD =================
for (let x = 17; x <= 36; x++) for (let y = 21; y <= 29; y++) {
const dx = (x - 26) / 7.5, dy = (y - 23) / 5.5;
const d = dx * dx + dy * dy;
if (d <= 1 && d >= 0.42) {
set(x, y, 1, GD); set(x, y, 2, GD); set(x, y, 3, GD);
set(x, y, 4, G);
}
}
// ---- trigger ----
box(23, 22, 1, 25, 25, 4, GX);
set(24, 25, 4, G);
// ================= GRIP =================
const gsx = 34.5, gsy = 20, gax = 4, gay = 16.5;
const glen = Math.hypot(gax, gay);
const pux = -gay / glen, puy = gax / glen;
for (let t = 0; t <= 19; t++) {
const u = t / 19;
const cx = gsx + gax * u, cy = gsy + gay * u;
for (let s = -4; s <= 4; s++) {
const X = Math.round(cx + pux * s);
const Y = Math.round(cy + puy * s);
let z0 = 0, z1 = 6;
if (Math.abs(s) >= 4) { z0 = 1; z1 = 5; }
let col;
if (u > 0.86 || Math.abs(s) >= 4) col = KD;
else if ((t + s) % 4 === 0 || (t - s) % 4 === 0) col = KL;
else col = K;
for (let z = z0; z <= z1; z++) set(X, Y, z, col);
}
}
// checkered highlight on the grip's upper face
for (let t = 1; t <= 16; t++) {
const u = t / 19;
const cx = gsx + gax * u, cy = gsy + gay * u;
for (let s = -3; s <= 3; s++) {
const X = Math.round(cx + pux * s);
const Y = Math.round(cy + puy * s);
if (get(X, Y, 6) === K && ((t + s) % 6 === 0)) set(X, Y, 6, KL);
}
}
// ================= PICKUP GLINT =================
part("glint", [24, 22, 10]);
set(24, 22, 10, "#ffffff");
set(23, 22, 10, "#ffe98a"); set(25, 22, 10, "#ffe98a");
set(24, 21, 10, "#ffe98a"); set(24, 23, 10, "#ffe98a");
set(24, 22, 9, "#fff6cc"); set(24, 22, 11, "#fff6cc");
void ("glint", { type: "bob", axis: "z", speed: 1.4, amplitude: 2 });
colors("glint", { palette: ["#ffffff", "#ffe98a", "#f7c948", "#ffffff"], pattern: "flicker", speed: 2.5, glow: 1 });import { draw } from "./assets/voxel";
import { armaPistolaDorada } from "./assets/arma-pistola-dorada";
// En cada cuadro: parado sobre (x, y), el centro de su base.
draw(ctx, armaPistolaDorada, 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-pistola-dorada
# Con las herramientas de Fogón (conector)
add_assets({ slug: "<tu-juego>", ids: ["arma-pistola-dorada"] })
# Queda en client/assets/arma-pistola-dorada.ts
# https://fogon.page/object/arma-pistola-dorada