Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FlxTilemapExt::overlapsWithCallback returns true for all sloped\special tiles considered #344

Open
increpare opened this issue Jun 30, 2020 · 0 comments

Comments

@increpare
Copy link

increpare commented Jun 30, 2020

Hi! Sorry about this - I haven't taken time to make an example, but thought I'd mention it here, and maybe elaborate on it in future.

If I understand correctly, FlxTilemapExt::overlapsWithCallback decides what tiles to check collisions on based on rough bounds (the row\column range stuff), and says that if overlaps if there's either an exact bounds match, or if it has some special property (the checkArrays bit)

if (overlapFound || (!overlapFound && checkArrays(tile.index)))
{
	if ((tile.callbackFunction != null) && ((tile.filter == null) || Std.is(Object, tile.filter)))
	{
		tile.mapIndex = rowStart + column;
		tile.callbackFunction(tile, Object);
	}
	results = true; //THIS RETURNS TRUE IF A SLOPE IS CONSIDERED, regardless even if you're outside the bounding box.
}

( https://github.com/HaxeFlixel/flixel-addons/blob/master/flixel/addons/tile/FlxTilemapExt.hx#L377 )

[ There's actually a second problem here as well - callbackFunction is a collision resolution function, so for slopes, overlapsWithCallback can have an effect, which I do not expect. ]

I feel like the source of the problem is that FlxTile only has one callback. Ideally there'd be custom overlap and resolve functions I'd guess? Or is there a better way to manage this?

(I should say, I'm willing to put work into getting this fixed myself, but would ideally like to do it in a way that could be pulled into\is compatible with the main engine :) )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant