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

Major change to FlxTilemap/FlxTiles Improve collision, debug drawing, add various features #3158

Merged
merged 39 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
63f198e
drawDebug boundingBox helpers
Geokureli May 30, 2024
1d7452a
allow tile instances to determine overlap
Geokureli May 30, 2024
0dcc4ad
simplify createTile
Geokureli May 30, 2024
c82f7a4
make overlapsObject dynamic
Geokureli Jun 1, 2024
acc56e7
cc
Geokureli Jun 1, 2024
32d2bc3
add orient + forEachOverlappingTile
Geokureli Jun 1, 2024
b8b9aec
add separateObjects and similar helpers, revert overlapsWithCallback …
Geokureli Jun 2, 2024
a0acd67
doc
Geokureli Jun 2, 2024
2b94c48
deprecate overrides
Geokureli Jun 2, 2024
eff32c9
fix deprecation warning
Geokureli Jun 2, 2024
eed56f4
add isOverlappingTile and docs to base
Geokureli Jun 2, 2024
713cff4
add since
Geokureli Jun 2, 2024
5951943
cc
Geokureli Jun 2, 2024
a4b3d0d
doc
Geokureli Jun 2, 2024
27c72f6
remove new public helpers
Geokureli Jun 3, 2024
5e84349
extract legacy code to new func
Geokureli Jun 3, 2024
d0d986c
cc
Geokureli Jun 3, 2024
e5d904a
add legacyCollision to coverage
Geokureli Jun 3, 2024
1a66569
separate tests
Geokureli Jun 3, 2024
1cce2a6
cleanup computeOverlap funcs
Geokureli Jun 3, 2024
527e966
add separate, computeOverlap tests
Geokureli Jun 3, 2024
2e00bee
check diagonal against walls
Geokureli Jun 3, 2024
2833bba
check immovable, recursively in collision
Geokureli Jun 3, 2024
2adb662
add other orient helpers
Geokureli Jun 4, 2024
c8a1f68
add overloaded setTile/getTile methods + tests
Geokureli Jun 4, 2024
fd43c1a
soft deprecation
Geokureli Jun 5, 2024
e7bf919
small cleanup
Geokureli Jun 5, 2024
ed921fe
better backwards compatibility
Geokureli Jun 6, 2024
170fd90
add since
Geokureli Jun 6, 2024
d078d89
more since
Geokureli Jun 6, 2024
9b03044
more since
Geokureli Jun 6, 2024
05a9d56
dd getRowAt, getColumnAt, rowExists and columnExists
Geokureli Jun 6, 2024
b53cf90
D'oh!
Geokureli Jun 6, 2024
d6ba657
D'OH!
Geokureli Jun 6, 2024
47383c9
processOverlaps -> objectOverlapsTiles + tests
Geokureli Jun 6, 2024
90887da
small changes
Geokureli Jun 6, 2024
ae67c73
test literal edge case
Geokureli Jun 6, 2024
2774f0a
more small stuff
Geokureli Jun 6, 2024
072daa8
D'OH!!
Geokureli Jun 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
699 changes: 373 additions & 326 deletions flixel/FlxObject.hx

Large diffs are not rendered by default.

15 changes: 9 additions & 6 deletions flixel/math/FlxRect.hx
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,18 @@ class FlxRect implements IFlxPooled
}

/**
* Checks to see if some FlxRect object overlaps this FlxRect object.
* Checks to see if this rectangle overlaps another
*
* @param Rect The rectangle being tested.
* @return Whether or not the two rectangles overlap.
* @param rect The other rectangle
* @return Whether the two rectangles overlap
*/
public inline function overlaps(Rect:FlxRect):Bool
public inline function overlaps(rect:FlxRect):Bool
{
var result = (Rect.x + Rect.width > x) && (Rect.x < x + width) && (Rect.y + Rect.height > y) && (Rect.y < y + height);
Rect.putWeak();
final result = rect.right > left
&& rect.left < right
&& rect.bottom > top
&& rect.top < bottom;
rect.putWeak();
return result;
}

Expand Down
12 changes: 5 additions & 7 deletions flixel/path/FlxPathfinder.hx
Original file line number Diff line number Diff line change
Expand Up @@ -617,10 +617,8 @@ class FlxTypedPathfinderData<Tilemap:FlxBaseTilemap<FlxObject>>

public function hasValidStartEnd()
{
return startIndex >= 0
&& endIndex >= 0
&& startIndex < map.totalTiles
&& endIndex < map.totalTiles;
return map.tileExists(startIndex)
&& map.tileExists(endIndex);
}

public function destroy()
Expand All @@ -647,15 +645,15 @@ class FlxTypedPathfinderData<Tilemap:FlxBaseTilemap<FlxObject>>
*/
inline function getX(tile:Int)
{
return tile % map.widthInTiles;
return map.getColumn(tile);
}

/**
* Helper for converting a tile index to a Y index.
*/
inline function getY(tile:Int)
{
return Std.int(tile / map.widthInTiles);
return map.getRow(tile);
}

/**
Expand All @@ -664,7 +662,7 @@ class FlxTypedPathfinderData<Tilemap:FlxBaseTilemap<FlxObject>>
inline function getTileCollisionsByIndex(tile:Int)
{
#if debug numChecks++; #end
return map.getTileCollisions(map.getTileByIndex(tile));
return map.getTileData(tile).allowCollisions;
}
}

Expand Down
Loading
Loading