Destroy tiles in a FlxTilemap

  • Hi everyone,

    I'm trying to make a map of destroyable tiles, created using Tiled and imported with the tiled utilities in the addons library. The idea is to destroy a certain type of tile when a bullet collides with it.

    The way I'm trying to do this is by using setTileProperties on the type of tile I want to make destroyable, and passing a callback method that looks like this:

        public static function destroyTileCallback(tile:FlxObject, obj:FlxObject):Void {
            tile.visible = false;
   = false;

    Unfortunately this doesn't seem to remove the tile from the screen, even though the function is called on collision as it should, and the properties are properly set on the tile.

    What's happening here? Am I missing something important?

    Thank you!

  • administrators

    Check out the SetTileProperties demo, it does exactly what you want using setTileByIndex():

  • Thanks @Gama11, that solution works!

Log in to reply

Looks like your connection to HaxeFlixel was lost, please wait while we try to reconnect.