← Weapons3D assetfogon/arma-cohete-teledirigido
Cohete teledirigido
Drag to turn it// «Cohete teledirigido» · propio
// A sci-fi homing missile launcher: grey tube with a small targeting screen on top and a red-tipped missile peeking out.
const colors = () => {};
part("body");
// ---- main launcher tube (lies flat along X) ----
for (let x = 4; x <= 38; x++) {
for (let y = 16; y <= 32; y++) {
for (let z = 0; z <= 14; z++) {
const dy = y - 24, dz = z - 7;
const d = Math.sqrt(dy * dy + dz * dz);
if (d <= 7.15) {
let c;
if (d > 6.1) c = dz >= 0 ? "#6b717b" : "#4d525a";
else if (dz > 3) c = "#a2a9b3";
else if (dz < -3) c = "#5e646d";
else c = "#7e848d";
if (rand() < 0.12) c = dz > 0 ? "#8e949e" : "#767c86";
set(x, y, z, c);
}
}
}
}
// band rings around the tube
[11, 22, 33].forEach(bx => {
for (let y = 16; y <= 32; y++)
for (let z = 0; z <= 14; z++)
if (get(bx, y, z)) set(bx, y, z, z > 7 ? "#5a6068" : "#3f444b");
});
// rear cap + nozzle
cylinder(2, 24, 7, 6, 2, "#4d525a", "x");
cylinder(3, 24, 7, 4, 1, "#1b1f23", "x");
// muzzle rim
for (let y = 16; y <= 32; y++)
for (let z = 0; z <= 14; z++)
if (get(38, y, z)) set(38, y, z, "#3d4249");
// top rail
box(12, 22, 14, 32, 26, 14, "#6b717b");
box(13, 23, 15, 31, 25, 15, "#9aa1ab");
// ---- targeting screen housing ----
box(16, 20, 12, 26, 28, 17, "#4a4f58");
for (let x = 17; x <= 25; x++)
for (let y = 21; y <= 27; y++)
if (x === 17 || x === 25 || y === 21 || y === 27) set(x, y, 18, "#33383f");
// ---- screen (animated glow) ----
part("screen");
for (let x = 18; x <= 24; x++)
for (let y = 22; y <= 26; y++)
set(x, y, 17, "#2fe8a0");
// ---- body details ----
part("body");
// side vent panels
for (let x = 28; x <= 31; x++) {
for (let z = 4; z <= 10; z++) {
for (let y = 16; y <= 24; y++) { if (get(x, y, z)) { set(x, y, z, "#22262b"); break; } }
for (let y = 32; y >= 24; y--) { if (get(x, y, z)) { set(x, y, z, "#22262b"); break; } }
}
}
// front side bolts
for (let z = 3; z <= 11; z += 4) {
for (let y = 16; y <= 20; y++) { if (get(36, y, z)) { set(36, y, z, "#22262b"); break; } }
for (let y = 32; y >= 28; y--) { if (get(36, y, z)) { set(36, y, z, "#22262b"); break; } }
}
// ---- rear beacon ----
part("beacon");
cylinder(7, 24, 14, 2, 2, "#33383f", "z");
sphere(7, 24, 16, 1.6, "#ff4d3d");
// ---- antenna ----
part("body");
part("antenna");
line(26, 24, 18, 28, 24, 22, 0, "#9aa1ab");
sphere(28, 24, 22, 1, "#e2564a");
// ---- missile peeking out ----
part("missile");
for (let x = 36; x <= 43; x++) {
for (let y = 20; y <= 28; y++) {
for (let z = 3; z <= 11; z++) {
const dy = y - 24, dz = z - 7;
if (dy * dy + dz * dz <= 17) {
let c;
if (dz > 1.5) c = "#f2f4f6";
else if (dz < -1.5) c = "#a9b0b8";
else c = "#dfe3e8";
if (x === 39) c = "#c1352b";
set(x, y, z, c);
}
}
}
}
function discX(x, r, color) {
for (let y = 24 - r; y <= 24 + r; y++)
for (let z = 7 - r; z <= 7 + r; z++) {
const dy = y - 24, dz = z - 7;
if (dy * dy + dz * dz <= r * r + 0.6) set(x, y, z, color);
}
}
discX(44, 4, "#b8302a");
discX(45, 3, "#c1352b");
discX(46, 2, "#e2564a");
discX(47, 1, "#ef8a7a");
// ---- animation ----
void ("missile", { type: "bob", axis: "x", speed: 1.5, amplitude: 1.3 });
void ("antenna", { type: "swing", axis: "x", speed: 1.8, amplitude: 0.22 });
colors("screen", { palette: ["#2fe8a0", "#1fd0d8", "#a8ffd0", "#0e7a5a"], pattern: "noise", speed: 1.6, glow: 0.9 });
colors("beacon", { palette: ["#ff4d3d", "#ffb03a", "#7a1a12"], pattern: "flicker", speed: 2.5, glow: 0.8 });import { draw } from "./assets/voxel";
import { armaCoheteTeledirigido } from "./assets/arma-cohete-teledirigido";
// Every frame: standing on (x, y), the centre of its base.
draw(ctx, armaCoheteTeledirigido, 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 arma-cohete-teledirigido
# With Fogón's tools (connector)
add_assets({ slug: "<your-game>", ids: ["arma-cohete-teledirigido"] })
# It lands in client/assets/arma-cohete-teledirigido.ts
# https://fogon.page/object/arma-cohete-teledirigido