Extensions Test Backdrop

boolean object.testBackdrop ( [number layer [, number xoff [, number yoff] ] ] )

Tests if the object is currently overlapping a backdrop obstacle.

If a layer is specified, the test is limited to that layer.  By default, layer is equal to mmf.ANY_LAYER.  If the xoff or yoff parameters are specified, the test is made as if the object had first been moved by those amounts (but without actually moving the object).

Parameters

layer Optional.  1-based layer index, or constants mmf.ANY_LAYER, mmf.SAME_LAYER, or mmf.DIFF_LAYER 
xoff Optional.  X coordinate offset to shift object before making the test
yoff Optional.  Y coordinate offset to shift object before making the test

Return Values

boolean true if object is overlapping a backdrop obstacle, false otherwise

Example

-- Assume we have an object "goomba"
-- Attempt to dig our goomba out of the background
while (goomba.testBackdrop()) do
  goomba.y = goomba.y - 1
end

Copyright 2010 Justin Aquadro