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

Changin rendered maps #28

Open
josebaMdeL opened this issue Dec 13, 2020 · 2 comments
Open

Changin rendered maps #28

josebaMdeL opened this issue Dec 13, 2020 · 2 comments

Comments

@josebaMdeL
Copy link

Hi!

I'm using this plugin to make a game and I'm trying to be able to change from main menu to a map, and from the map to another map.

My idea was to load a default instance of TiledMapComponents at startup, and then use a system where I query the componetn with:
mut tiled_map: Query<&mut TiledMapComponents>,

and make something like:

            for mut c in tiled_map.iter_mut() {
                println!("Showing map...");
                c.map_asset = asset_server.load(map_path.as_str()); // here we load the new map
                c.center = TiledMapCenter::default(); // This centers the map view again, I guess?
            }

The problem is that I don't know why the query comes empty, when it should have the only TiledMapComponents component that was spawned at startup, so I can't make any changes on rendered map.

Also, if I try to commands.despawn, or despawn_recursive, the game crashes at:
(line 454 of maps.rs file.

let map = maps.get_mut(changed_map).unwrap();

Any idea what could be happening?

@dmtaub
Copy link
Collaborator

dmtaub commented Mar 15, 2021

TilemapComponents is not persisted currently, so you can't query for it In the next week or two I plan to push changes targeting bevy/main which allow you to pass a toplevel entity in, but that is not here yet. It is on my fork for now, if you want to try it out:

@josebaMdeL
Copy link
Author

Hi!,

Thanks for the respond, but I finally get my own rendering system.

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