Extensions Test Point

boolean mmf.frame.testPoint ( number x, number y [, number layer] )

Test a point on the frame's collision mask for a backdrop obstacle.  The test can optionally be limited to a layer.

Parameters

x X coordinate on frame
y Y coordinate on frame
layer Optional.  1-based layer index, or constant mmf.ANY_LAYER

Return Values

boolean true if there's an obstacle at the given point, false otherwise

Example

-- Assume we have an object "goomba"
-- Turn around if he hit a backdrop while moving right
if (mmf.frame.testPoint(goomba.xRight, goomba.yBottom - 8)) then
  goomba.x = goomba.x - 1
  goomba.direction = mmf.DIR_W
end

Copyright 2010 Justin Aquadro