← Asian3D assetfogon/maquina-de-gachapon
Máquina de gachapón
Drag to turn it// «Máquina de gachapón» · gpt-6-sol (medium)
// A Japanese capsule toy machine: a tall box with a red lower body, a big round turning knob on the front, a clear window on top full of colorful round capsules (pink, blue, yellow, green), and a small output slot at the bottom with a capsule in it.
const red = "#ad292a", redLight = "#ce4440", redDark = "#761d25";
const gold = "#e9bd62", goldDark = "#a87535";
const jade = "#397267", tile = "#294e48", tileLight = "#4d7970";
const stone = "#ded9c7";
// White stone footing and lacquered lower cabinet.
box(10, 15, 0, 38, 37, 1, "#aaa99c");
box(11, 16, 2, 37, 36, 3, stone);
box(12, 18, 4, 36, 35, 23, redDark);
box(12, 15, 4, 36, 18, 23, red);
box(12, 15, 20, 36, 18, 23, redLight);
box(12, 15, 4, 36, 18, 5, redDark);
box(12, 19, 4, 13, 35, 23, redLight);
box(35, 19, 4, 36, 35, 23, redDark);
// Gold corner guards and horizontal trim.
for (const x of [12, 36]) {
box(x, 14, 3, x, 18, 23, goldDark);
box(x, 14, 20, x, 15, 23, gold);
}
box(11, 14, 22, 37, 19, 23, gold);
box(11, 14, 3, 37, 19, 3, goldDark);
box(12, 14, 4, 36, 14, 4, gold);
// Deep, dark interior keeps the capsules visible through the open window.
box(12, 18, 24, 36, 35, 38, "#244542");
box(13, 17, 24, 35, 18, 25, jade);
box(13, 18, 37, 35, 35, 38, jade);
// Colorful two-piece toy capsules, piled behind the window.
const colors = [
["#ec83a9", "#bd527b"],
["#70bbde", "#397eae"],
["#f4d66f", "#cc9e3f"],
["#8bc78d", "#4d9872"]
];
function capsule(x, y, z, i) {
const [top, bottom] = colors[i % colors.length];
sphere(x, y, z, 2.45, bottom);
for (let dx = -2; dx <= 2; dx++)
for (let dy = -2; dy <= 2; dy++)
for (let dz = 0; dz <= 2; dz++)
if (dx*dx + dy*dy + dz*dz <= 6.1)
set(x+dx, y+dy, z+dz, top);
for (let dx = -2; dx <= 2; dx++)
for (let dy = -2; dy <= 2; dy++)
if (dx*dx + dy*dy <= 5) set(x+dx, y+dy, z, "#f0ead5");
set(x-1, y-2, z+1, "#fff7e5");
}
for (const [x, y, z, c] of [
[16,29,27,1],[22,29,27,2],[28,29,27,0],[33,29,27,3],
[19,26,32,3],[25,26,32,0],[31,26,32,1],
[15,21,27,0],[21,21,27,3],[27,21,27,2],[33,21,27,1],
[17,21,33,2],[23,21,33,1],[29,21,33,3],[34,21,33,0]
]) capsule(x,y,z,c);
// Window frame: unobstructed center, glass glints at the edges.
for (const x of [11, 12, 36, 37]) box(x, 14, 24, x, 18, 38, goldDark);
box(13, 14, 24, 35, 17, 25, gold);
box(13, 14, 37, 35, 17, 38, gold);
box(13, 16, 26, 13, 16, 36, "#b5dfd2");
box(35, 16, 26, 35, 16, 36, "#94c9bf");
line(15, 16, 35, 18, 16, 36, 0, "#e5f4d9");
line(32, 16, 27, 34, 16, 29, 0, "#b5dfd2");
// Temple-inspired glazed roof, with raised, upturned eaves.
box(9, 13, 39, 39, 39, 40, tile);
box(8, 12, 39, 40, 40, 39, tileLight);
box(8, 12, 38, 40, 12, 38, goldDark);
box(8, 13, 40, 10, 16, 42, tileLight);
box(38, 13, 40, 40, 16, 42, tileLight);
box(8, 37, 40, 10, 40, 42, tileLight);
box(38, 37, 40, 40, 40, 42, tileLight);
box(11, 16, 41, 37, 36, 41, tileLight);
box(14, 19, 42, 34, 33, 43, tile);
box(17, 21, 44, 31, 31, 44, tileLight);
box(21, 23, 45, 27, 29, 45, jade);
for (let x = 12; x <= 36; x += 4)
box(x, 15, 41, x, 37, 41, "#70a092");
box(18, 12, 39, 30, 12, 40, goldDark);
box(21, 11, 39, 27, 11, 40, gold);
// Recessed dispensing slot and a waiting capsule.
box(21, 13, 5, 30, 14, 11, goldDark);
box(22, 12, 6, 29, 13, 10, "#261f26");
box(23, 12, 10, 28, 12, 10, gold);
sphere(25, 11, 7, 2, "#54a996");
box(24, 9, 7, 26, 11, 8, "#e38aad");
set(24, 9, 8, "#fff2d8");
// Fixed gold bezel around the winding mechanism.
cylinder(24, 12, 15, 5, 2, goldDark, "y");
cylinder(24, 11, 15, 4, 1, gold, "y");
cylinder(24, 10, 15, 3, 1, redDark, "y");
for (let a = 0; a < 8; a++) {
const t = a * Math.PI / 4;
set(24 + Math.round(4.5*Math.cos(t)), 10,
15 + Math.round(4.5*Math.sin(t)), "#fff0b2");
}
// The projecting, off-center grip makes its rotation easy to read.
part("knob", [24, 9, 15]);
cylinder(24, 7, 15, 3, 3, gold, "y");
cylinder(24, 6, 15, 2, 1, redLight, "y");
line(24, 6, 15, 26, 6, 17, 1, goldDark);
sphere(27, 5, 18, 1.5, "#f2d477");
set(27, 4, 18, "#fff1b5");
animate("knob", {type:"spin", axis:"y", speed:1.5});import { draw } from "./assets/voxel";
import { maquinaDeGachapon } from "./assets/maquina-de-gachapon";
// Every frame: standing on (x, y), the centre of its base.
draw(ctx, maquinaDeGachapon, 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 maquina-de-gachapon
# With Fogón's tools (connector)
add_assets({ slug: "<your-game>", ids: ["maquina-de-gachapon"] })
# It lands in client/assets/maquina-de-gachapon.ts
# https://fogon.page/object/maquina-de-gachapon