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

layers and moving sprites #534

Open
Mergpijp opened this issue Jun 1, 2024 · 4 comments
Open

layers and moving sprites #534

Mergpijp opened this issue Jun 1, 2024 · 4 comments

Comments

@Mergpijp
Copy link

Mergpijp commented Jun 1, 2024

Hello,

I have a 3 layered map and a highlighter to see cursor and possible movements.
Now I have placed my character at x=0, y=0 I also gave it a TilePos 32, 31. I want to move the character I want to use transform with a query how do i convert a TilePos to a real world 2d coordinate? I only found TilePos::from_world_post() function. Thanks in advance.

@rparrett
Copy link
Collaborator

rparrett commented Jun 1, 2024

It sounds like you're looking for TilePos::center_in_world.

@Mergpijp
Copy link
Author

Mergpijp commented Jun 1, 2024

Hi, thank you very much I think that is it couldnt test it yet because I am still busy I have a problem with the double Transform queries I know i need to use Without but what without for this package?
mut characters: Query<(&mut Transform, &mut Player, Without<TilemapBundle>,)>, //mut mousebtn_evr: EventReader<MouseButtonInput>, mouse_button: Res<ButtonInput<MouseButton>>, // We'll actually change the map contents for highlighting window_query: Query<Entity, With<PrimaryWindow>>, q_window: Query<&Window, With<PrimaryWindow>>, mut cursor_pos: ResMut<CursorPos>, //camera_q: Query<(&GlobalTransform, &Camera)>, previous_highlighted: ResMut<PreviousHighlighted>, tilemap_q: Query<( &TilemapSize, &TilemapGridSize, &TilemapType, &TileStorage, &Transform, Without<Player>, )>, //mut tid: Query<&mut TileTextureIndex>,) tid: Query<&mut TileTextureIndex>, )

@Mergpijp
Copy link
Author

Mergpijp commented Jun 1, 2024

Okay I am sorry it was: Without TilemapId

@Mergpijp Mergpijp closed this as completed Jun 1, 2024
@Mergpijp
Copy link
Author

Mergpijp commented Jun 2, 2024

If i do that translation on my character with TilePos::center_in_world. It places the character not on tile but on a different location how can this be? do i need more conversion because axis start in the center? Also I used mouse_to_tile example should I make a draw function or just draw in the Cursor moved event? Is there overhead making more updates? It seems i can only draw in the cursor moved event why is this?

@Mergpijp Mergpijp reopened this Jun 2, 2024
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

No branches or pull requests

2 participants