Troubles with FlxTilemap collisions

Alright, the Internet, I need your help. I'm a relatively experienced programmer, but this is my first foray into Haxe and Flixel as well. I'm working on a game similar to Atari Breakout or DX Ball. Having extracted the relevant code, I am still faced with the same issue, when the ball sprite collides with the tile map, it destroys the brick it is normally supposed to, and then has another collision event (in the same frame!) with the brick immediately to the right of the correct brick. I had no issues with this using FlxG.collide, or FlxG.overlap, but now switching to FlxTilemap.overlapsWithCallback (which I would like to use for functionality purposes later on down the road), I have this weird effect.

Seeing as I'm not sure what "original AS3 Flixel" is, I don't think I'm a good candidate to answer that question. I can tell you I have tried HTML, Neko, and C++ targets with Lime, all with the same result.

Flixel originated as an ActionScript 3 Framework, and HaxeFlixel is a port of that (at this point, it has a lot more functionality however). Since the APIs you're using were all already present in AS3 Flixel (I think), it would be interesting to know if this is a bug that was already present there, or if this was newly introduced in HaxeFlixel. I might try porting your example to find out when I have some time.

@classicError404 I isolated the example a bit and found that you're using a custom collision function via overlapsWithCallback(). Is there a particular reason for that? I don't think setting elasticity or immovable on a FlxTile instance really does anything.

Anyway, the problem goes away if you use a regular FlxG.collide() call instead:

Thanks for investigating this, also sorry I didn't see this 'till now. I had tried using FlxG.collide, but I wanted control of whether or not FlxObject.separate was called. Now that may seem picky of me, but I wanted that control so that I could add specific power-ups for the player. For instance, a player might have a power-up that allowed the ball to continue traveling in the same direction after destroying a brick . It seemed to me that by using FlxG.collide I was unable to control that aspect of the collision handling. I also used tileCallback, so that later on individual tiles could have different properties on collision.

On a related note, I messed about with FlxG.overlaps and setting my own notifyCallback and processCallback, but I am receiving the whole map in my callback, not the specific tile that the ball collided with, so I don't see how to set the colliding tile as no longer active.

To summarize,

What's the best way to control the calls toFlxObject.separate for the ball?

How can I have each individual tile have distinct properties?

My guess is that by me planning for future features I missed something simpler and more elegant ... I just can't seem to find what it is.

My suggestion would be to use FlxSprite instances for the bricks, rather than a tilemap. Not only does this make collisions simpler to handle, it's also much more flexible. You actually have an instance for each individual brick that way, can give it health, animations, etc... This is not the case with FlxTilemap, which is optimized to only have one FlxTile instance per tile type, so you're fairly limited in what you can do.

Of course, FlxSprite instances will be less efficient than using a FlxTilemap, but I don't see that becoming a big issue.

I had tried using sprites with tileToSprite quite a while ago, and it dropped me down to about 30 FPS. However frame rate isn't a huge concern of mine. I also expect I shall experiment with a few things to improve performance, such as less tiles in general, or making them larger; things like that. I had forgotten I tried that, so I will take another look.