Extensions Test Class Get Extended

table class.testClassGetEx ( object class [number layer] )

Returns a one-to-many associative list of objects from the first object class and the objects from the second object class that they overlap.  If an object doesn't overlap anything from the target object class, it's excluded from the results.

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

Parameters

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

Return Values

table A one-to-many associative list of objects and their matches. 

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"
local matches = GoombaClass.testClassGetEx(ShellClass)
for goomba,shellSet in pairs(matches) do
  for k,shell in pairs(shellSet) do
    if (shell.sliding) then
      goomba.Destroy()
      break
    end
  end
end


See also:
     Test Class, Test Class Get

Copyright 2010 Justin Aquadro