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

Added an example to iso_diamond example for handling tile clicks in respect to the 2d camera #529

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

Conversation

ThunderSizzle
Copy link

I added an example to iso_diamond's example for working with the cursor position with the tile map. This permits the user to click on any tile to change the color while the example is running. Left clicking increments the tile's color index, and right clicking decrements the tile's color index.

This is to offer an example for this issue: https://github.com/StarArawn/bevy_ecs_tilemap/issues/305Issue 305

--
Part of the reason for this example is that it took me the better part of a week to figure out how to do this. I wanted an example of this to be accessible.

@rparrett
Copy link
Collaborator

This seems to be implementing Bevy's viewport_to_world_2d manually. I think #305 probably predates that addition to Bevy, and can be closed now.

We also have a mouse_to_tile example that works with iso diamond.

@ThunderSizzle
Copy link
Author

@rparrett: Thanks for reviewing. I see now my misunderstanding of the mouse_to_tile example. I didn't realize that "CursorPos" was self-contained in the example. I attempted using TilePos::from_world_pos using the cursor position from the window, which obviously didn't work, hence how I guess ended up rebuilding "viewport_to_world_2d" that I didn't know existed.

That simplifies my usage quite a bit. Thank you!

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.

2 participants