Extensions Test Object Get

object[] class.testObjectGet ( object object [number layer] )

Returns a list of all objects that are a member of the object class and currently overlapping another specified object.

If a layer is specified, the test is limited to instances on that layer.  By default, layer is equal to mmf.ANY_LAYER.

Parameters

object Table representing an object instance
layer Optional.  1-based layer index, or constants mmf.ANY_LAYER, mmf.SAME_LAYER, or mmf.DIFF_LAYER 

Return Values

object[] A list of objects matching the test

Example

-- Assume we have "Goomba" and "Koopa Shell" objects on the frame
-- Goombas are destroyed if they collide with sliding koopa shells
local ShellClass = mmf.newObjectClass("Koopa Shell")
local GoombaClass = mmf.newObjectClass("Goomba")
 
-- Assume koopa shells have the boolean property "sliding"
for k, shell in pairs(ShellClass.objectList) do
  if (shell.sliding) then
    local matches = GoombaClass.testObject(shell)
    for j, goomba in pairs(matches) do
      goomba.Destroy()
    end
  end
end


See also:
     Test Object

Copyright 2010 Justin Aquadro