Collision Mask Module

The Collision Mask Module is a module for the Monkey-X programming language to perform pixel perfect collision detection.
All the code is open source. The Collision Mask Utilities programs are licenced under the MIT licence and the Monkey-X module is public domain.

Downloads are at the bottom of this page.

The Collision Mask Module consists of:

  • Two applications written in Qt (C++) that run on Windows/Linux/MacOS and allow you to create and view “collision masks” from the alpha data in PNG images.
  • A Monkey-X module (a single file) that contains the scaling, rotation and collision detection code.
  • Four example applications.
  • An API reference and the custom mask file format specification.

The Monkey-X module is written in 100% standard Monkey-X code and does not require any changes to Mojo. In fact, apart from the Debug display feature, it doesn’t even require Mojo. It works on all Monkey-X targets.

Features include:

  • Synchronous and Asynchronous loading of mask files.
  • Rotation and scaling of masks.
  • Pre-allocation of empty masks for use as targets for rotation and scaling, avoiding allocation of memory in the main game loop.
  • Mask to mask collision detection.
  • Point to mask collision detection.
  • Rectangle to mask collision detection.
  • Circle to mask collision detection.
  • On-screen display of masks for debugging purposes.

Clicking on the images below will display the interactive HTML version of the example:

Collision Module Test Screenshot Collision Module Race Screenshot
Collision Module Drop Screenshot Collision Module Boom Screenshot

Downloads:

Required:
Download (174.4 KB) Collision Mask Monkey-X Module V1.0 (All Platforms)

Download (21.1 MB) Collision Utilities V1.0 (for Windows, includes source code)

Collision Utilities binaries are not yet available for MacOS X and Linux, but the source code will compile and run on both platforms.

Optional:
Download (347.0 KB) Collision Utilities Source Code V1.0

Download (137.8 KB) CMSK Collision Mask File Specification V1.0 R1 (PDF, Also included in module download)

Comments are closed.