Search the Community
Showing results for tags 'dynamic tilemap resize'.
Found 1 result
Hi there! I'm trying to create an indefinite 1-way sidescroller game with a randomly generated World. For this conveniently to work I have prefactored blueprint-Tilemaps with the Tiled-Editor, which I want to glue together whenever the player moves into an unloaded area. I've already achieved to create a big level before it starts by appending layers (layers.data-array) together, but this is performance-heavy and does not work well on slow devices. In this context I've decided start with a small pregenerated map, which gets changed while the player is running through the level from left to right. I want to unload chunks of the map when the players leaves them and stick a new blueprint in front before the player reaches the right side, so you think the level is Indefinite. Phase 1: Create a tilemap from a few blueprints stitched together (works) Phase 2: Start the level: the player runs on the map from left right until the level end is near. (works) Phase 3: Randomly pick a prefactored blueprint and stick it on the right side of the map and update the size of it (does not work for me dynamically) Phase 4: Unload/remove left part of the map, which the player has left (have not tried yet) So my question for you: How can I update a tilemap after changing its size so it gets rendered/loaded correctly? Especially changing the world size/borders, as I cannot find a Phaser example for this use case. What I have tried so far: A ) Using the same method from Phase 1: I'm combining Tilemap.layers.data from the different blueprints and update layers.width and layers.height) B ) Adding Layers to the Tilemap.layers Array and offsetting layers.x by layers.width. A and B do not render the updated tilemap, sadly, even when using .resizeWorld() after the change. Thank you for reading this far and maybe leaving a helpful reply. =)