Skip to content

Commit

Permalink
add various forEachInRay helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
Geokureli committed Jan 10, 2025
1 parent 21cb868 commit bc54752
Show file tree
Hide file tree
Showing 2 changed files with 245 additions and 51 deletions.
18 changes: 18 additions & 0 deletions flixel/tile/FlxBaseTilemap.hx
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,24 @@ class FlxBaseTilemap<Tile:FlxObject> extends FlxObject
return false;
}

/**
* Shoots a ray from the start point to the end point.
* If/when it passes through a tile, it stores that point and returns false.
*
* **Note:** In flixel 5.0.0, this was redone, the old method is now `rayStep`
*
* @param start The world coordinates of the start of the ray.
* @param end The world coordinates of the end of the ray.
* @param result Optional result vector, to avoid creating a new instance to be returned.
* Only returned if the line enters the rect.
* @return Returns true if the ray made it from Start to End without hitting anything.
* Returns false and fills Result if a tile was hit.
*/
public function forEachOverlappingRay(start:FlxPoint, end:FlxPoint, ?func:FlxPoint):Void
{
throw "ray must be implemented";
}

/**
* Shoots a ray from the start point to the end point.
* If/when it passes through a tile, it stores that point and returns false.
Expand Down
Loading

0 comments on commit bc54752

Please sign in to comment.