Flash as3: Framedifferencing collission detection (hitTest)

Combination of Frame Differencing and hitTest in as3. Inspired by the Processing sketch of Andy Best where you can pop bubbles if there is movement. By checking the difference between two frames (current and the previous one) we know where there was movement. The movement is stored in a bitmap and with that we can do a collission detection with other bitmap objects in the screen. In the example below you’ll see two balls that change colour and position when hit. Code is in the zip-file. See my post about Frame differencing for other Flash and Processing examples.

Example (Flash Player 10 or higher)

You need a webcam and give Flashplayer access to the camera to see the example below :

Get Adobe Flash player

Used resources

Download : Framedifferencing collision detection – source code If you have suggestions for more improvements, please give your feedback in the comments.