Godot Version
4.4
Question
` I’m making a 2D platformer and was wondering how I should go about programming in a back level layer like Spelunky 2 or Mario Wonder.
I know Mario Wonder has a level off to the side and just uses a camera to capture it but I’d rather have my system function more like Spelunky 2’s back layer levels.
I was thinking of using sub viewports but I’ve barely looked into that and am not sure how to have it work with Spelunky 2’s backlayer transition style.
I was also wondering if there’s any sort of greater collision layer that affects all collision layers under it like a parent. `
I looked up a playthrough of Spelunky 2. Are you talking about how the player can go through some kind of door outline in the background and it transitions between levels? It looks like what they do is this:
- fade out the old background and show the new level instead in the background
- zoom in on the current level while fading it out
- zoom in on the background at a different rate than the current level
Anyway, you don’t necessarily need to use viewports for this, you can use canvaslayers, which have their own separate transforms from each other, so they can zoom in at different rates.
1 Like
Yeah that’s exactly what I’m talking about. I never thought to use canvas layers but it makes perfect sense, thanks!
I’m still wondering, how would I go about the different collisions between each level layer?
Would I just have the back layer level be way off to the side and anything that travels through the door would be teleported to the other side of the door in the far off level?
This seems like the way to handle different level layer collision but I’m wondering if there might be a better way. I know that I could just modify the collision layer and mask values but that seems unnecessarily overengineered.
I’m not sure how the layers work exactly. Do the two layers need to be loaded in at the same time? If not, then you can just use the same collision layers for both of them, and since the player can’t move when the transition animation is playing, they won’t cause an issue.