A fork of {{sketch.parentSketch.title}} by {{sketch.parentUser.fullname}}.

Archived Sketch

This sketch is created with an older version of Processing,
and doesn't work on browsers anymore.

View Source Code

Click record or press 'R'
to start/stop recording (max. 10 secs)

Click capture
to take a screenshot

Pixel Level Collision Detection

The bigger fish follows the mouse position. In this sketch the two fish only collide when two non-transparent pixels (one from each image) appear at the same screen position. When a collision occurs the sketch draws a red box round each image. The algorithm is quite efficient because it first tests to see if the images overlap, and if they do it then compares only those pixels in the overlap area are tested.
e.g. "mouse, keyboard"
e.g. "visualization, fractal, mouse"
learn more about Creative Commons

As a Plus+ Member feature, this source code is hidden by the owner.