The game object defines two easy methods for dealing with collisions. The first is entityAt(p) this returns the first entity at the point p. Note that this is not necessarily the entity "on top" - it is the last-created one.
The second function is entityBoxAt(r) which is the same as entityAt, only it searches the entire area of rect r.

Applying these functions
You might, for example, use entityBoxAt(obj.position) to find an overlapping object, or use it on a transformed position of an object to check if it is moving into a "free" space.

Functions that deal with collisions with specific entities will be available in the next release of LDK.

Last edited Dec 13, 2009 at 11:50 PM by larztheloser, version 1


No comments yet.