Skip to content

Commit

Permalink
add FlxTypedTilemapExt
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesisfeline authored Feb 18, 2024
1 parent 822a61b commit 4bd965d
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion flixel/addons/tile/FlxTilemapExt.hx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,33 @@ using flixel.util.FlxColorTransformUtil;
* Downward Slope fix
* @author Early Melon
*/
class FlxTilemapExt extends FlxTilemap
class FlxTilemapExt extends FlxTypedTilemap<FlxTile>
{
function initTileObjects():Void
{
if (frames == null)
return;

_tileObjects = FlxDestroyUtil.destroyArray(_tileObjects);
// Create some tile objects that we'll use for overlap checks (one for each tile)
_tileObjects = new Array<FlxTile>();

var length:Int = frames.numFrames;
length += _startingIndex;

for (i in 0...length)
_tileObjects[i] = new FlxTile(this, i, tileWidth, tileHeight, (i >= _drawIndex), (i >= _collideIndex) ? allowCollisions : NONE);

// Create debug tiles for rendering bounding boxes on demand
#if FLX_DEBUG
updateDebugTileBoundingBoxSolid();
updateDebugTileBoundingBoxNotSolid();
updateDebugTileBoundingBoxPartial();
#end
}
}

class FlxTypedTilemapExt<Tile:FlxTile> extends FlxTypedTilemap<Tile>
{
// Slope related variables
var _snapping:Int = 2;
Expand Down

0 comments on commit 4bd965d

Please sign in to comment.