8000 feat: Add physics layer support to TileMaps by SpectralDragon · Pull Request #67 · AdaEngine/AdaEngine · GitHub
[go: up one dir, main page]

Skip to content

feat: Add physics layer support to TileMaps #67

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

SpectralDragon
Copy link
Contributor

This change introduces physics layer (collision filtering) capabilities to TileMaps in AdaEngine.

Key changes include:

  1. TileMapLayer Enhancement:

    • Added a collisionFilter: CollisionFilter property to TileMapLayer, allowing each layer to define its own collision category and mask.
  2. TileMapSystem Update:

    • The system now applies the collisionFilter from the TileMapLayer to the Collision2DComponent of individual tile entities when they are created.
  3. LDtk Integration:

    • Ldtk.TileMap can now parse physics layer information from custom properties in LDtk layer definitions.
    • It expects integer custom properties named physicsLayer_categoryBitMask and physicsLayer_collisionBitMask on layers.
    • These values are used to configure the collisionFilter on the corresponding TileMapLayer.
  4. Testing:

    • Added a new test suite TileMapPhysicsTests with comprehensive tests for various collision scenarios involving TileMap layers and external entities, verifying the correct behavior of category and mask bits.
  5. Example Scene:

    • Created a new example scene scene_tilemap_physics_app.
    • This scene demonstrates how to set up different physics layers in a TileMap (ground, obstacles, collectibles) and how a player entity interacts with them based on their collision filters.

This feature allows for more granular control over physics interactions in tile-based levels, enabling developers to create more complex and robust game mechanics.

@SpectralDragon SpectralDragon linked an issue May 24, 2025 that may be closed by this pull request
google-labs-jules bot and others added 2 commits May 27, 2025 20:32
This change introduces physics layer (collision filtering) capabilities to TileMaps in AdaEngine.

Key changes include:

1.  **`TileMapLayer` Enhancement:**
    - Added a `collisionFilter: CollisionFilter` property to `TileMapLayer`, allowing each layer to define its own collision category and mask.

2.  **`TileMapSystem` Update:**
    - The system now applies the `collisionFilter` from the `TileMapLayer` to the `Collision2DComponent` of individual tile entities when they are created.

3.  **LDtk Integration:**
    - `Ldtk.TileMap` can now parse physics layer information from custom properties in LDtk layer definitions.
    - It expects integer custom properties named `physicsLayer_categoryBitMask` and `physicsLayer_collisionBitMask` on layers.
    - These values are used to configure the `collisionFilter` on the corresponding `TileMapLayer`.

4.  **Testing:**
    - Added a new test suite `TileMapPhysicsTests` with comprehensive tests for various collision scenarios involving TileMap layers and external entities, verifying the correct behavior of category and mask bits.

5.  **Example Scene:**
    - Created a new example scene `scene_tilemap_physics_app`.
    - This scene demonstrates how to set up different physics layers in a TileMap (ground, obstacles, collectibles) and how a player entity interacts with them based on their collision filters.

This feature allows for more granular control over physics interactions in tile-based levels, enabling developers to create more complex and robust game mechanics.
@SpectralDragon SpectralDragon force-pushed the feat/tilemap-physics-layers branch from c0e4ca9 to 2e4e0e0 Compare May 27, 2025 17:40
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

Successfully merging this pull request may close these issues.

TileMap doesn’t support a physics
1 participant
0