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

Conversation

Geokureli
Copy link
Member

@Geokureli Geokureli commented May 31, 2024

New features

Tiles

  • New dynamic orientAt method in FlxTile, used to position and resize the tile based on the grid location it is meant to represent in world space.
  • Added helper methods: `orient
  • New dynamic overlapsObject method in FlxTile, can be extended or set to allow custom overlap detection for tiles whose hit shape is smaller than the tileGrid
  • New onCollide signal, dispatched when overlaps are checked for collision reasons

Tilemaps

  • New forEachOverlappingTile method in FlxTilemap, to retrieve every tile that is overlapping the given object
  • Using forEachOverlappingTile in overlapsWithCallbacks
  • Alters the createTile method (also added in 5.9.0 and therefore not released) to remove the allowCollisions and visible args, it is recommended to simply reference the map's drawIndex and collideIndex in your override if you need these to your tile instances
  • 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

Objects

  • Add internal helper processCheckTilemap for calling overlap checking utils between some combination of objects and tilemaps
  • Add helper methods for separate and updateTouchingFlags

Debug Drawing

  • Checks the previously unused tile.ignoreDrawDebug when debug drawing tiles
  • Checks tile.debugBoundingBoxColor in debug drawing, if null, the map's debug drawing properties is used, as usual
  • New getDebugBoundingBoxColor in FlxObject. Meant to replace drawDebugBoundingBox, will deprecate later

(semi) Breaking changes

Previously, overlaps with callback would call the callback regardless of whether the tile overlapped the object. This change only effects objects placed exactly on the edge of a tile, and typically it was used to call separate, which would not do any separation in this case. this is technically a breaking change, but the case is so rare I'm going to add this on a minor release.

TODO

  • New unit tests

@Geokureli Geokureli added this to the 5.9.0 milestone Jun 1, 2024
@Geokureli Geokureli changed the title Tiles Major change to FlxTilemap/FlxTiles Improve collision, debug drawing, add various features Jun 4, 2024
@Geokureli
Copy link
Member Author

this seems ready, still nervous as it's pretty huge (that's what she said)

gonna look over it tomorrow with fresh eyes

@Geokureli Geokureli merged commit 8489570 into HaxeFlixel:dev Jun 11, 2024
11 checks passed
@Geokureli Geokureli mentioned this pull request Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant