fogón

← Piezas de nivel 2Objeto 3Dfogon/nivel-estrella-de-poder

Estrella invencible

de fogonCC03042 bloques
Estrella invencibleArrastrá para girarlo
// «Estrella invencible» · gpt-6-sol (medium)
// A rainbow invincibility star: a chunky five-point star standing upright facing -y, 34 wide, 6 thick, with two black oval eyes, floating with its lowest points at z 4; its color cycles through bright colors.

const outline = [
  [24, 42.9], [29, 31], [41.8, 29.5], [31, 20.7],
  [35, 3.5], [24, 13.9], [13, 3.5], [17, 20.7],
  [6.2, 29.5], [19, 31]
];

function inside(x, z) {
  // The star's outline is shifted down four blocks so its tips reach z=0.
  z += 4;
  let hit = false;
  for (let i = 0, j = outline.length - 1; i < outline.length; j = i++) {
    const [ax, az] = outline[i];
    const [bx, bz] = outline[j];
    if ((az > z) !== (bz > z) &&
        x < (bx - ax) * (z - az) / (bz - az) + ax) hit = !hit;
  }
  return hit;
}

part("estrella", [24, 24, 20]);

for (let x = 7; x <= 41; x++) {
  for (let z = 0; z <= 38; z++) {
    if (!inside(x + 0.5, z + 0.5)) continue;

    const edge =
      !inside(x - 0.5, z + 0.5) ||
      !inside(x + 1.5, z + 0.5) ||
      !inside(x + 0.5, z - 0.5) ||
      !inside(x + 0.5, z + 1.5);

    for (let y = 22; y <= 27; y++) {
      let color = "#ffcb38";
      if (y === 22) color = edge ? "#ffe673" : "#ffda4e";
      if (y === 23 && edge) color = "#ffe062";
      if (y >= 26) color = edge ? "#d98e24" : "#efad30";
      if (y === 24 && !edge && rand() < 0.025) color = "#ffdc54";
      set(x, y, z, color);
    }
  }
}

animate("estrella", { type: "spin", axis: "z", speed: -2 });
animate("estrella", {
  type: "colors",
  palette: ["#ff4040", "#ffd040", "#40e070", "#40a0ff", "#c060ff"],
  pattern: "wave",
  glow: 0.6
});

// Separate part keeps the eyes black during the rainbow color cycle.
part("eyes", [24, 24, 20]);
for (const cx of [19, 29]) {
  for (let dx = -1; dx <= 1; dx++) {
    for (let dz = -2; dz <= 2; dz++) {
      if (dx * dx / 2.25 + dz * dz / 6.25 <= 1) {
        set(cx + dx, 22, 21 + dz, "#171326");
      }
    }
  }
  set(cx - 1, 22, 23, "#51465b");
}
animate("eyes", { type: "spin", axis: "z", speed: -2 });