tmGroundProbe

Finds the ground under a round body, for slopes, curves and loops. Two feet, one each side of the middle, look "down" for the body's angle. tmGroundX and tmGroundY then say where the body's centre belongs, and tmGroundAngle gives the ground's angle. The SpeedLevel example shows it in use. Takes map (The map's handle), layer (The layer's number, from tmAddLayer or tmGetLayer), x (The body's centre x, in world pixels), y (The body's centre y, in world pixels), angle (The body's angle in degrees. 0 is standing on flat ground), radius (How far the centre sits above the ground, in pixels), foot (How far each foot is from the middle, in pixels), from (How far down from the centre to start looking, in pixels), reach (How far down from the centre to stop, in pixels), flags (The flag bits to look for. 0 means any tile that isn't empty). Returns: 1 if it finds ground, otherwise 0.

Tilemap

Parameters & Returns

Parameters

map Int
layer Int
x Double
y Double
angle Double
radius Int
foot Int
from Int
reach Int
flags Int

Returns

Int

Quick Summary

Finds the ground under a round body, for slopes, curves and loops. Two feet, one each side of the middle, look "down" for the body's angle. tmGroundX and tmGroundY then say where the body's centre belongs, and tmGroundAngle gives the ground's angle. The SpeedLevel example shows it in use. Takes map (The map's handle), layer (The layer's number, from tmAddLayer or tmGetLayer), x (The body's centre x, in world pixels), y (The body's centre y, in world pixels), angle (The body's angle in degrees. 0 is standing on flat ground), radius (How far the centre sits above the ground, in pixels), foot (How far each foot is from the middle, in pixels), from (How far down from the centre to start looking, in pixels), reach (How far down from the centre to stop, in pixels), flags (The flag bits to look for. 0 means any tile that isn't empty). Returns: 1 if it finds ground, otherwise 0.

Technical Exegesis...

Finds the ground under a round body, for slopes, curves and loops. Two feet, one each side of the middle, look "down" for the body's angle. tmGroundX and tmGroundY then say where the body's centre belongs, and tmGroundAngle gives the ground's angle. The SpeedLevel example shows it in use.

See the Tilemaps guide.

Returns: 1 if it finds ground, otherwise 0.

Example

Example.bam
If tmGroundProbe(map, plane, x, y, angle, 12, 8, 0, 24, 0) Then
    x = tmGroundX()
    y = tmGroundY()
    angle = tmGroundAngle()
EndIf