← Piezas de nivel 2Objeto 3Dfogon/nivel-esquina-de-rampa
Esquina de rampa
Arrastrá para girarlo// «Esquina de rampa» · gpt-6-sol (medium)
// An outer corner piece for ramps: a full 48x48 footprint, a solid pyramid-like corner rising from z 0 along the front edge (y 0) AND the left edge (x 0) up to z 24 at the back-right corner (x 47, y 47), so it joins a ramp going up along y and one going up along x. Grass top in green stripes, brown dirt on the vertical faces.
// Outer corner ramp: the front and left edges start at floor level,
// while the back and right edges climb to the back-right corner.
for (let x = 0; x < 48; x++) {
for (let y = 0; y < 48; y++) {
const height = Math.floor(Math.min(x, y) * 24 / 47);
for (let z = 0; z < height; z++) {
const nearSurface = height - z <= 3;
let dirt = nearSurface ? "#a65d32" : "#ad6838";
// Clean horizontal bands make exposed dirt faces readable.
if (z % 7 === 0) dirt = "#96542f";
if (rand() < 0.035) dirt = "#bd7741";
set(x, y, z, dirt);
}
// Wide diagonal grass stripes across the sloping top.
const stripe = (x + y) % 14;
const grass = stripe < 5 ? "#80df48"
: stripe < 9 ? "#68cb38"
: "#57b92f";
set(x, y, height, grass);
}
}import { draw } from "./assets/voxel";
import { nivelEsquinaDeRampa } from "./assets/nivel-esquina-de-rampa";
// En cada cuadro: parado sobre (x, y), el centro de su base.
draw(ctx, nivelEsquinaDeRampa, 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-esquina-de-rampa
# Con las herramientas de Fogón (conector)
add_assets({ slug: "<tu-juego>", ids: ["nivel-esquina-de-rampa"] })
# Queda en client/assets/nivel-esquina-de-rampa.ts
# https://fogon.page/object/nivel-esquina-de-rampa