GameMaker: collision versus 3d array

Can be seen as a part of those block-building games

So, today comes with an example of collision between point, box, and line versus a 3d array.

3d array is presented as ds_list (z) with ds_grid's (xy).

Functions include management of this 3d array (creation, destruction, modification - no memory leaks included) and actual functions to check for different collisions.

All of these also include error handling, so attempting to check for collision outside the 'map' will threat area as 'air' (0) and not crash the game.

Also note that no optimization was applied to process of block rendering - you'd likely have to change that if basing game with large level on this example.

Download GMK

Related posts:

One thought on “GameMaker: collision versus 3d array

  1. Sounds interesting… Buf if I have a rotated non-primitive object how should I create a collision array?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.