# Crash BASIC 1.43.0 Release Notes

*~written by Crash-tan~*

## THE "POLYGONS COME ALIVE" UPDATE

`POLYGON` has always drawn a shape and walked away — it paints pixels into a
layer, and if you want it to move you redraw it yourself, every frame, by hand.
This release gives polygons a second life: one that **animates itself**, lives
above its layer like a sprite, and never touches the layer underneath.

---

## `SET POLYGON` — a polygon that's *bound* to a mutation

A `MUTATION` is just a list of points. A polygon is just a list of points. So
now you can tie them together:

```basic
DIM blob AS MUTATION
blob = MUTATION((160, 70), (215, 120), (190, 190), (130, 190), (105, 120))

BEHAVIOR "Wobble"
    BOSCILLATE AMPLITUDE 14, 14 SPEED 3 PHASE 0 VARIANCE(0, 6.28)
END BEHAVIOR
SET MUTATION blob BEHAVIOR "Wobble"

SET POLYGON 0 BIND blob FILL 4
```

That's it. The polygon's vertices **are** the mutation. Put a behavior on the
mutation and the polygon follows every frame on its own — no per-frame redraw,
no interpreter work in your render loop. It composites **above** its layer in
the sprite draw order, on the GPU, so a deforming, wobbling shape costs about
what a sprite costs instead of re-rasterizing into the layer each frame.

Remove one with `DESTROY POLYGON id`.

---

## Fill it, texture it, animate the texture, shade it

A bound polygon is a first-class visual:

- **`FILL color`** — solid fill (correct on concave shapes — see below).
- **`COLOR color`** — an outline colour.
- **`TEXTURE name`** — map a loaded image across it. With no UVs given, the
  image auto-fits the polygon's bounding box.
- **`UV uvMutation`** — bind the *texture coordinates* to a **second** mutation.
  Put a behavior on that one and the texture itself warps, scrolls, and swims
  across the shape while the shape does its own thing. Two independent
  animations, one polygon.
- **`SHADER "name", @param=value`** — run a sprite shader on it, exactly like
  you would on a sprite. A textured polygon samples its image through the
  shader, so all your tints, dissolves, and effects just work.

```basic
SET POLYGON 0 BIND quad TEXTURE "tex" UV uvs SHADER "Tint", @speed=3.0
```

---

## `POLYGON` now fills concave shapes

The classic immediate `POLYGON` command (and the new bound one) switched from a
triangle fan to **ear-clipping** triangulation. The short version: stars,
arrows, crescents, L-shapes — any concave polygon now fills correctly instead of
spilling outside its outline. Convex shapes look exactly as before.

---

## Mutations are now floating-point

Under the hood, a mutation's coordinates used to be whole integers, even though
every other coordinate in Crash BASIC is floating-point. That mismatch quietly
quantized every behavior-driven mutation to whole pixels each tick. Mutations
are now **floating-point**, matching the rest of the language — so anything
driven by a mutation (polygon vertices, animated UVs, point paths) moves
**smoothly** instead of stepping.

**What this means for you:**

- `MUTATIONPOINTX` / `MUTATIONPOINTY` now return floating-point values. Whole
  numbers still print without a trailing `.0`, so existing programs read the
  same; if you specifically relied on these being truncated to integers, round
  them yourself.
- Mutation coordinates now keep their fractional part through behaviors and
  across the network.

---

## Compatibility

Existing programs are unaffected unless they leaned on the old integer-only
mutation behaviour described above. `POLYGON` renders the same for convex
shapes and *better* for concave ones. Everything else is additive — `SET
POLYGON` is a brand-new command, nothing old changed shape.
