← Piezas de nivel 2Objeto 3Dfogon/nivel-escudo
Escudo de poder
Arrastrá para girarlo// «Escudo de poder» · gpt-6-sol (medium)
// A power-up shield: a big heater-shape shield standing upright facing -y, 32 tall and 26 wide, 4 thick, with a thick gold rim, a royal blue face, and a white star emblem in the center; a light highlight on the upper left. It floats a bit above the floor (bottom at z 4).
part("escudo", [24, 24, 16]);
const goldLight = "#ffe169";
const gold = "#f9bb32";
const goldDark = "#d98a20";
const blue = "#2359d9";
const blueLight = "#3475ef";
const blueDark = "#1744b4";
function bounds(z) {
if (z >= 14) return [11, 36];
const half = Math.max(0.5, 12.5 * z / 14);
return [Math.ceil(23.5 - half), Math.floor(23.5 + half)];
}
// Solid, four-block-thick shield: z=0 is its pointed bottom.
for (let z = 0; z <= 31; z++) {
const [left, right] = bounds(z);
for (let x = left; x <= right; x++) {
const rim = z >= 29 || z <= 3 || x < left + 3 || x > right - 3;
for (let y = 22; y <= 25; y++) {
let color;
if (rim) {
color = z >= 29 || x === left ? goldLight :
z <= 4 || x === right ? goldDark : gold;
if (y === 23 || y === 24) color = goldDark;
} else {
color = z <= 6 || x === right - 3 ? blueDark :
z >= 25 || x === left + 3 ? blueLight : blue;
if (y === 23 || y === 24) color = blueDark;
}
set(x, y, z, color);
}
}
}
// Five-pointed white emblem, visible from either side.
const points = [];
for (let i = 0; i < 10; i++) {
const angle = Math.PI / 2 + i * Math.PI / 5;
const radius = i % 2 === 0 ? 9.2 : 4.1;
points.push([
23.5 + Math.cos(angle) * radius,
17 + Math.sin(angle) * radius
]);
}
function insideStar(x, z) {
let inside = false;
for (let i = 0, j = points.length - 1; i < points.length; j = i++) {
const [xi, zi] = points[i];
const [xj, zj] = points[j];
if ((zi > z) !== (zj > z) &&
x < (xj - xi) * (z - zi) / (zj - zi) + xi) {
inside = !inside;
}
}
return inside;
}
for (const y of [22, 25]) {
// Pale-blue gleam in the upper-left corner.
for (let z = 25; z <= 27; z++) {
for (let x = 15; x <= 18; x++) {
if (get(x, y, z) === blueLight || get(x, y, z) === blue) {
set(x, y, z, "#78baff");
}
}
}
for (let z = 8; z <= 27; z++) {
for (let x = 14; x <= 33; x++) {
const color = get(x, y, z);
if (insideStar(x, z) && color &&
color !== goldLight && color !== gold && color !== goldDark) {
set(x, y, z, z < 14 ? "#dfeeff" : "#ffffff");
}
}
}
}
animate("escudo", { type: "spin", axis: "z", speed: -2 });
animate("escudo", { type: "bob", axis: "z", amplitude: 1.5 });import { draw } from "./assets/voxel";
import { nivelEscudo } from "./assets/nivel-escudo";
// En cada cuadro: parado sobre (x, y), el centro de su base.
draw(ctx, nivelEscudo, 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-escudo
# Con las herramientas de Fogón (conector)
add_assets({ slug: "<tu-juego>", ids: ["nivel-escudo"] })
# Queda en client/assets/nivel-escudo.ts
# https://fogon.page/object/nivel-escudo