← Piezas de nivel 2Objeto 3Dfogon/nivel-plataforma-movil
Plataforma móvil
Arrastrá para girarlo// «Plataforma móvil» · gpt-6-sol (medium)
// A moving platform: a floating 40x40 slab (x 4..43, y 4..43) 5 thick, made of wooden planks with a yellow and black hazard stripe border on its sides, and small grey metal propeller pods under each corner; it floats with its top at z 24.
part("plataforma", [24, 24, 22]);
// Five-block-thick floating slab, with its top at z = 24.
box(4, 4, 20, 43, 43, 23, "#966338");
box(5, 5, 20, 42, 42, 20, "#704a32");
// Dark lower rail and bright upper lip.
for (let i = 4; i <= 43; i++) {
set(i, 4, 20, "#535e67");
set(i, 43, 20, "#535e67");
set(4, i, 20, "#535e67");
set(43, i, 20, "#535e67");
set(i, 4, 24, "#ffd35a");
set(i, 43, 24, "#ffd35a");
set(4, i, 24, "#ffd35a");
set(43, i, 24, "#ffd35a");
}
// Diagonal yellow-and-black hazard stripes on all four sides.
for (let z = 21; z <= 23; z++) {
for (let i = 4; i <= 43; i++) {
const stripe = ((i + 2 * z) % 8) < 4 ? "#ffd044" : "#30343a";
set(i, 4, z, stripe);
set(i, 43, z, stripe);
set(4, i, z, stripe);
set(43, i, z, stripe);
}
}
// Broad wooden planks with staggered joints.
box(5, 5, 24, 42, 42, 24, "#754b30");
const wood = ["#d99a55", "#e6aa62", "#cb8849", "#dfa05b"];
for (let row = 0, y = 5; y <= 42; row++, y += 6) {
const end = Math.min(y + 4, 42);
const joint = row % 2 ? 29 : 18;
box(5, y, 24, joint - 1, end, 24, wood[row % wood.length]);
box(joint + 1, y, 24, 42, end, 24, wood[(row + 1) % wood.length]);
for (const x of [7, joint - 2, joint + 2, 40]) {
set(x, y + 1, 25, "#b7bec0");
}
}
// Metal bracing beneath the slab.
box(9, 10, 19, 38, 11, 19, "#67737c");
box(9, 36, 19, 38, 37, 19, "#67737c");
box(10, 9, 19, 11, 38, 19, "#67737c");
box(36, 9, 19, 37, 38, 19, "#67737c");
// Four connected motor pods. Their propellers reach z = 0.
for (const x of [10, 37]) {
for (const y of [10, 37]) {
// Supports run all the way from the underside to each motor.
cylinder(x, y, 9, 2, 11, "#626f78");
cylinder(x, y, 7, 3, 4, "#89969d");
// Chunky grey motor housing.
cylinder(x, y, 4, 4, 5, "#aeb9be");
cylinder(x, y, 5, 3, 3, "#d8e0df");
cylinder(x, y, 3, 4, 1, "#697780");
cylinder(x, y, 1, 2, 3, "#49555e");
// Four-blade propeller at floor height.
box(x - 5, y - 1, 0, x + 5, y + 1, 0, "#899ba3");
box(x - 1, y - 5, 0, x + 1, y + 5, 0, "#899ba3");
box(x - 1, y - 1, 0, x + 1, y + 1, 1, "#e4b446");
set(x, y, 2, "#f8e1a1");
}
}
animate("plataforma", {
type: "bob",
axis: "z",
amplitude: 6,
speed: 1.5
});import { draw } from "./assets/voxel";
import { nivelPlataformaMovil } from "./assets/nivel-plataforma-movil";
// En cada cuadro: parado sobre (x, y), el centro de su base.
draw(ctx, nivelPlataformaMovil, 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 nivel-plataforma-movil
# Con las herramientas de Fogón (conector)
add_assets({ slug: "<tu-juego>", ids: ["nivel-plataforma-movil"] })
# Queda en client/assets/nivel-plataforma-movil.ts
# https://fogon.page/object/nivel-plataforma-movil