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

TileMap: Add method to fetch the layer for a given body #76246

Merged
merged 1 commit into from
Apr 25, 2023

Conversation

Proggle
Copy link
Contributor

@Proggle Proggle commented Apr 19, 2023

Currently it isn't possible to find the tilemap layer of what object you're colliding with. This adds a tilemap method, get_layer_for_body_rid(), which works just like the already-existing get_coords_for_body_rid(), except it returns the tilemap layer instead of the tilemap coordinates.

Bugsquad edit:

Copy link
Member

@groud groud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs the commits to be squashed. Looks good otherwise.

scene/2d/tile_map.h Outdated Show resolved Hide resolved
@Proggle
Copy link
Contributor Author

Proggle commented Apr 24, 2023

Needs the commits to be squashed. Looks good otherwise.

Sorry to ask, but can someone better with Git squash that for me? Something is screwy with git on my computer, I spent an hour talking with the helpful people in godot development chat trying to run commands and it keeps refusing to work.

I could make a new branch from scratch with the changes, but from what I understand that would also produce a new pull request rather than merging into this one.

@akien-mga akien-mga force-pushed the tilemap-rid-layer-report branch from 73fb18c to 093cb90 Compare April 25, 2023 10:50
@akien-mga akien-mga changed the title adding method to fetch layers from tilemap, get_layer_for_body_rid() TileMap: Add method to fetch the layer for a given body Apr 25, 2023
@akien-mga akien-mga requested review from groud and KoBeWi April 25, 2023 10:51
@akien-mga
Copy link
Member

Needs the commits to be squashed. Looks good otherwise.

Sorry to ask, but can someone better with Git squash that for me? Something is screwy with git on my computer, I spent an hour talking with the helpful people in godot development chat trying to run commands and it keeps refusing to work.

No problem, I squashed the commits for you :)

@akien-mga akien-mga modified the milestones: 4.x, 4.1 Apr 25, 2023
@akien-mga akien-mga merged commit 0093660 into godotengine:master Apr 25, 2023
@akien-mga
Copy link
Member

Thanks! And congrats for your first merged Godot contribution 🎉

@Proggle Proggle deleted the tilemap-rid-layer-report branch April 30, 2023 04:00
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.

Add a method to return the TileMap layer a given RID is on, as well as the X/Y coordinates
5 participants