How do I keep my player on the correct layer when changing layouts?

0 favourites
  • 5 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • I'm working on screen transitions and I have my player object on the player layer before they enter the second layout. They are able to enter the second layout, but when they return to the first layout they are on the wrong layer. I'm not even sure how I would go about correcting this, any ideas?

  • So the player is global? You need to keep the same number of layers in each layout. Layout 2 likely has fewer layers.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • On leaving layout 1 you could save the name of the layer that the player sprite is on to a global variable and then on start of layout 2 move the player sprite to that layer using the global variable in the "Move to Layer" action. Likewise on transitioning back from 2 to 1.

  • I will look at both of these options and let you guys know. Thank you for responding!

  • I've run into this issue before too. It stems from the fact *I think* that global objects maintain their layer Id (not layer name, the id) on layout transitions. Which totally makes sense.

    Lets say in LayoutA that the layer with Id 2 has a name "midground". But in LayoutB the layer with Id 2 has a name of "foreground". So if your global object is on the layer with Id 2, going from LayoutA to LayoutB will make it seem like they changed layers from "midground" to "foreground". But C3 is simply keeping the layer id persistent of the global object.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)