tmRayCast

Looks along a line for the first tile with these flags, respecting tile shapes and flips. On an isometric map the line is in grid pixels, and on staggered and hexagonal maps this returns 0. tmHitWorldX and tmHitWorldY give the point where the line reached it. Takes map (The map's handle), layer (The layer's number, from tmAddLayer or tmGetLayer), x1 (The start x, in world pixels), y1 (The start y, in world pixels), x2 (The end x, in world pixels), y2 (The end y, in world pixels), flags (The flag bits to look for. 0 means any tile that isn't empty). Returns: 1 if it hits, otherwise 0.

Tilemap

Parameters & Returns

Parameters

map Int
layer Int
x1 Int
y1 Int
x2 Int
y2 Int
flags Int

Returns

Int

Quick Summary

Looks along a line for the first tile with these flags, respecting tile shapes and flips. On an isometric map the line is in grid pixels, and on staggered and hexagonal maps this returns 0. tmHitWorldX and tmHitWorldY give the point where the line reached it. Takes map (The map's handle), layer (The layer's number, from tmAddLayer or tmGetLayer), x1 (The start x, in world pixels), y1 (The start y, in world pixels), x2 (The end x, in world pixels), y2 (The end y, in world pixels), flags (The flag bits to look for. 0 means any tile that isn't empty). Returns: 1 if it hits, otherwise 0.

Technical Exegesis...

Looks along a line for the first tile with these flags, respecting tile shapes and flips. On an isometric map the line is in grid pixels, and on staggered and hexagonal maps this returns 0. tmHitWorldX and tmHitWorldY give the point where the line reached it.

See the Tilemaps guide.

Returns: 1 if it hits, otherwise 0.

Example

Example.bam
canSee = 1 - tmRayCast(map, ground, ex, ey, px, py, 1)