How do I manage layers?

0 favourites
  • 5 posts
  • Hi All

    Not sure if this is a bug or if I am doing something wrong. Can anyone please share some thought on this problem.

    I have a platform game with several layers. My player is on a layer called “player” in all layouts.

    All is good and well. When I test the game in debug mode he is on layer “player” at run-time, but as soon as I add an additional layer and I test the game the players starts on the wrong layer at run-time. (So far it seems to be one layer lower) I doubled check the player settings under common and the player is definitely on the “player” layer.

    Any idea why this would happen? It is a problem as the player will appear behind my backgrounds when on the wrong layer. I would like the player to be on the layer I set it to.

    Thank you

  • If you are using an event to "Create player on layer X" then the layer should really be reference by the "layer name" rather than by the (number).

    IE Create player on layer "player" ; instead of Create player on layer 3

    If you are referencing the creation of the player by the layer number, those numbers will change depending on your ordering. If you always reference by the name, it won't matter what order they're in - it will always go to the correctly specified layer.

    ~Sol

  • Are you sure your layer "player" is at the same ordering position in all layouts ?

    Is it in front (on top) of background layers you don't want it to appear under ?

    Is your player object global ? Is its layer propery set to "player" (name of the layer) and not a number ?

    You should consider posting the capx of your project as this will be easier to investigate and tell you precisely what may be going wrong.

    For examples of how to properly use layers, I'd suggest you check out some videos from the C2 Academy, they'll show you how it works exactly.

  • If you are using an event to "Create player on layer X" then the layer should really be reference by the "layer name" rather than by the (number).

    IE Create player on layer "player" ; instead of Create player on layer 3

    If you are referencing the creation of the player by the layer number, those numbers will change depending on your ordering. If you always reference by the name, it won't matter what order they're in - it will always go to the correctly specified layer.

    ~Sol

    Thanks for replying

    I do not use an event to place the sprite on the layer, but I have tried this and the results are still the same.

    Here I have the player animations (also on “player” layer)

    When using an event at start of layout the animations still appear on the layer below - tiles

    Image here - http://imgur.com/a/jotze

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi Kyatric

    Thanks, that pointed me in the right direction. I see now it does not matter what layers I add or what I call them my player will always be on layer 2 so somewhere I have a setting that does this. Need to debug. PS I am already subscribed to you channel

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