CNA Samples

Transformed Collision

Ported from Microsoft's XNA 4.0 2D Collision Tutorial 3: Transformed.

Source for this sample on GitHub ↗

Rotating spinner blocks fall toward a stick-figure player on a blue background. Play ▸

Opens in a new tab. Click the canvas so it receives keyboard input.

About this sample

Move the person beneath falling, rotating spinner blocks. A collision turns the background red only when the visible pixels touch. The game first checks a bounding rectangle, then tests the transformed pixels inside it.

Controls

ActionKeyboardGamepad
Move personLeft / Right arrowD-pad left / right
ExitEsc or close the tabBack