Extensions Test Class

boolean class.testClass ( object class [number layer] )

Tests if any object that is a member of the obejct class is 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

boolean true if an object is overlapping an instance of the specified class, false otherwise

Example

-- Assume we have "matter" and "antimatter" objects on the frame
-- If any of the opposite objects touch, the game ends
local mClass = mmf.newObjectClass("matter")
local aClass = mmf.newObjectClass("antimatter")
 
if (mClass.testClass(aClass)) then
  print("Game over!")
end


See also:
     Test Class Get, Test Class Get Extended

Copyright 2010 Justin Aquadro