Extensions Test Class Get

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

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

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

object[] A list of objects that match the test

Example

-- Assume we have "Goomba" and "Spike" objects on the frame
-- Goombas are destroyed if they collide with spikes
local SpikeClass = mmf.newObjectClass("Spike")
local GoombaClass = mmf.newObjectClass("Goomba")
 
local matches = GoombaClass.testClass(SpikeClass)
for k, goomba in pairs(matches) do
  goomba.Destroy()
end


See also:
     Test Class, Test Class Get Extended

Copyright 2010 Justin Aquadro