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

More new features and overloads to tilemaps #3189

Merged
merged 4 commits into from
Jun 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,18 @@
- `FlxCamera`: Improve doc ([#3161](https://github.com/HaxeFlixel/flixel/pull/3161))
- `NextState`: Improve doc ([#3160](https://github.com/HaxeFlixel/flixel/pull/3160))
- `FlxSprite`: Account for `scale`, `origin`, `offset`, `angle` and `pixelPerfectPosition` in `getGraphicMidpoint` ([#3125](https://github.com/HaxeFlixel/flixel/pull/3125))
- Major change to `FlxTilemap` and `FlxTiles` collision ([#3158](https://github.com/HaxeFlixel/flixel/pull/3158))
- Major change to `FlxTilemap` and `FlxTiles` collision ([#3158](https://github.com/HaxeFlixel/flixel/pull/3158)) ([#3189](https://github.com/HaxeFlixel/flixel/pull/3189))
- `FlxTile`: Various features for allowing custom overlap/collision logic
- Add dynamic methods `overlapsObject` and `orientAt` with helpers `orient`, `orientByIndex` and `orientAtByIndex`
- Add `onCollide` signal, when overlaps are detected for collision purposes
- Tilemaps: Add various new tools and helpers to `FlxTilemap` and `FlxBaseTilemap`
- Added new `forEachOverlappingTile` calls a method with every tile that overlaps an object
- Added new `forEachOverlappingTile` which calls a method with every tile that overlaps an object
- Added new `forEachMapIndex` which calls a method with every tile of a certain tile index
- Added new `isOverlappingTile` method, allows you to check all tiles overlapping an object
- Added new `objectOverlapsTiles` to replace the now deprecated `overlapsWithCallbacks`
- Eschews `flipCallbackParams` arg, allowing better typing of both callback params
- Adds `isCollision` flag to control whether the Tiles' collision callbacks are fired and allows for processing non-solid tiles
- Added new helpers: `getMapIndex`, `getRow`, `getColumn`, `getTileIndex`, `getTileData`, `tileExists`, `setTileIndex`, `getColumnAt`, `getRowAt`, `columnExists` and `rowExists`
- Added new helpers: `getMapIndex`, `getMapIndexAt`, `getRow`, `getColumn`, `getTileIndex`, `getTileIndexAt`, `getTileData`, `getTileDataAt`, `tileExists`, `tileExistsAt`, `setTileIndex`, `setTileIndexAt`, `getColumnAt`, `getRowAt`, `columnExists`, `rowExists`, `columnExistsAt`, `rowExistsAt`, `getColumnPos`, `getRowPos`, `getColumnPosAt`, `getRowPosAt`, `getTilePos`, `getTilePosAt` and `getAllTilePos`
- `FlxObject`: Add internal helpers for processing tilemaps in `separate`, `updateTouchingFlags` and similar functions
- Debug Drawing: Various improvements to debug drawing tilemaps
- Now honors tiles' `ignoreDrawDebug` and `debugBoundingBoxColor` fields
Expand Down
2 changes: 1 addition & 1 deletion flixel/FlxG.hx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class FlxG
* The HaxeFlixel version, in semantic versioning syntax. Use `Std.string()`
* on it to get a `String` formatted like this: `"HaxeFlixel MAJOR.MINOR.PATCH-COMMIT_SHA"`.
*/
public static var VERSION(default, null):FlxVersion = new FlxVersion(5, 8, 1);
public static var VERSION(default, null):FlxVersion = new FlxVersion(5, 9, 0);

/**
* Internal tracker for game object.
Expand Down
6 changes: 3 additions & 3 deletions flixel/path/FlxPathfinder.hx
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ class FlxTypedPathfinder<Tilemap:FlxBaseTilemap<FlxObject>, Data:FlxTypedPathfin
public function findPath(map:Tilemap, start:FlxPoint, end:FlxPoint, simplify:FlxPathSimplifier = LINE):Null<Array<FlxPoint>>
{
// Figure out what tile we are starting and ending on.
var startIndex = map.getTileIndexByCoords(start);
var endIndex = map.getTileIndexByCoords(end);
final startIndex = map.getMapIndex(start);
final endIndex = map.getMapIndex(end);

var data = createData(map, startIndex, endIndex);
var indices = findPathIndicesHelper(data);
Expand Down Expand Up @@ -119,7 +119,7 @@ class FlxTypedPathfinder<Tilemap:FlxBaseTilemap<FlxObject>, Data:FlxTypedPathfin
function getPathPointsFromIndices(data:Data, indices:Array<Int>)
{
// convert indices to world coordinates
return indices.map(data.map.getTileCoordsByIndex.bind(_, true));
return indices.map((i)->data.map.getTilePos(i, true));
}

/**
Expand Down
Loading
Loading