← CiudadObjeto 3Dfogon/maquina-expendedora
Máquina expendedora
Arrastrá para girarlo// «Máquina expendedora» · gpt-6-sol (medium)
// A vending machine: a tall red boxy machine with a big glass front (-y) showing rows of colorful drink cans and snacks on shelves, a coin slot and buttons on the right side, and a dark pickup slot at the bottom.
// Red vending machine: front faces -y.
const red = "#d93639";
const redLight = "#ed4b48";
const redDark = "#a82430";
const cream = "#ffe1a0";
const gold = "#f5b946";
const metal = "#a9b9b7";
const darkMetal = "#536567";
const glass = "#183b49";
// Main cabinet, with subtly varied painted surfaces.
box(7, 16, 2, 40, 33, 39, red);
for (let x = 7; x <= 40; x++) {
for (let z = 2; z <= 39; z++) {
if (rand() < 0.075) set(x, 16, z, rand() < 0.5 ? redLight : redDark);
}
}
box(7, 15, 2, 40, 15, 39, red);
box(7, 16, 40, 40, 33, 40, redLight);
box(8, 15, 39, 39, 15, 39, redDark);
box(7, 15, 2, 8, 33, 38, redDark);
box(39, 15, 2, 40, 33, 38, redDark);
box(9, 15, 0, 16, 31, 2, darkMetal);
box(31, 15, 0, 38, 31, 2, darkMetal);
box(8, 14, 2, 39, 14, 3, redDark);
// Recessed display and its warm, chunky frame.
box(10, 14, 12, 30, 16, 33, glass);
box(11, 14, 13, 29, 14, 32, "#254b56");
box(11, 15, 13, 29, 15, 32, "#102d3a");
box(9, 13, 11, 10, 15, 34, cream);
box(30, 13, 11, 31, 15, 34, cream);
box(10, 13, 33, 30, 15, 34, gold);
box(10, 13, 11, 30, 15, 12, gold);
box(11, 13, 13, 29, 13, 13, metal);
box(11, 13, 20, 29, 13, 20, metal);
box(11, 13, 27, 29, 13, 27, metal);
box(11, 13, 32, 29, 13, 32, darkMetal);
box(11, 12, 13, 29, 12, 13, darkMetal);
box(11, 12, 20, 29, 12, 20, darkMetal);
box(11, 12, 27, 29, 12, 27, darkMetal);
// Cans and little snack packets, standing in three neat rows.
const canColors = [
["#44b6bc", "#a4f1e7"],
["#f4b63c", "#ffe18a"],
["#e86a80", "#ffb8ae"],
["#68ae60", "#c5e89a"],
["#8074c7", "#cfb9ed"]
];
for (let row = 0; row < 3; row++) {
const floor = 13 + row * 7;
for (let i = 0; i < 5; i++) {
const x = 12 + i * 4;
const [main, highlight] = canColors[(i + row * 2) % 5];
if (row === 1 && (i === 1 || i === 3)) {
box(x, 12, floor + 1, x + 2, 14, floor + 5, main);
box(x, 12, floor + 4, x + 2, 12, floor + 4, highlight);
set(x + 1, 11, floor + 3, gold);
box(x, 12, floor + 5, x + 2, 12, floor + 5, cream);
} else {
box(x, 12, floor + 1, x + 2, 14, floor + 5, main);
box(x, 11, floor + 1, x + 2, 12, floor + 1, darkMetal);
box(x, 11, floor + 5, x + 2, 12, floor + 5, metal);
box(x, 11, floor + 2, x, 11, floor + 4, highlight);
set(x + 1, 11, floor + 3, cream);
}
}
}
// A few pane reflections, kept away from the products.
box(10, 12, 28, 10, 12, 31, "#83c8cb");
box(11, 12, 31, 13, 12, 31, "#83c8cb");
box(28, 12, 14, 29, 12, 14, "#73aeb6");
set(29, 12, 15, "#73aeb6");
// Illuminated sign and hand-lettered, blocky SODA.
box(9, 14, 35, 38, 15, 39, "#bb3036");
box(10, 13, 35, 37, 13, 39, "#f8d681");
const letters = {
S: ["111", "100", "111", "001", "111"],
O: ["111", "101", "101", "101", "111"],
D: ["110", "101", "101", "101", "110"],
A: ["010", "101", "111", "101", "101"]
};
let left = 14;
for (const letter of "SODA") {
const glyph = letters[letter];
for (let r = 0; r < 5; r++) {
for (let c = 0; c < 3; c++) {
if (glyph[r][c] === "1") set(left + c, 12, 39 - r, "#a62833");
}
}
left += 5;
}
box(8, 14, 40, 39, 32, 40, cream);
// Right-hand payment and selection console.
box(32, 13, 12, 39, 15, 33, redDark);
box(33, 12, 15, 38, 12, 31, "#dbe4d6");
box(34, 11, 26, 37, 11, 29, metal);
box(34, 10, 27, 37, 10, 27, "#29373c");
box(35, 10, 28, 36, 10, 28, "#f6f4d7");
box(34, 11, 24, 37, 11, 25, "#385e65");
set(35, 10, 24, "#a1e3b9");
set(36, 10, 24, "#a1e3b9");
const buttons = ["#f6bc43", "#75c5c4", "#ed7480", "#91ba6e", "#a88cdd", "#f6bc43"];
for (let i = 0; i < 6; i++) {
const x = 34 + (i % 2) * 3;
const z = 21 - Math.floor(i / 2) * 2;
box(x, 10, z, x + 1, 11, z + 1, darkMetal);
set(x, 9, z + 1, buttons[i]);
set(x + 1, 9, z + 1, buttons[i]);
}
box(33, 11, 14, 38, 11, 15, gold);
// Deep pickup hatch, with a bright protective lip.
box(11, 13, 4, 30, 15, 10, redDark);
box(12, 12, 5, 29, 14, 9, "#202b30");
box(13, 11, 5, 28, 11, 7, "#132027");
box(12, 11, 9, 29, 11, 10, metal);
box(12, 11, 4, 29, 11, 4, gold);
box(14, 11, 6, 27, 11, 6, "#405257");
// Decorative fileteado-inspired corner flourishes.
for (const x of [9, 38]) {
set(x, 13, 36, gold);
set(x, 13, 37, cream);
set(x, 13, 38, gold);
}
box(8, 14, 5, 9, 14, 9, gold);
box(38, 14, 5, 39, 14, 9, gold);import { draw } from "./assets/voxel";
import { maquinaExpendedora } from "./assets/maquina-expendedora";
// En cada cuadro: parado sobre (x, y), el centro de su base.
draw(ctx, maquinaExpendedora, 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 maquina-expendedora
# Con las herramientas de Fogón (conector)
add_assets({ slug: "<tu-juego>", ids: ["maquina-expendedora"] })
# Queda en client/assets/maquina-expendedora.ts
# https://fogon.page/object/maquina-expendedora