How do I manage layers?

Get help using Construct 2

Post » Thu Jul 14, 2016 9:05 am

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
B
45
S
13
Posts: 118
Reputation: 3,251

Post » Thu Jul 14, 2016 9:13 am

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
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
83
S
34
G
40
Posts: 3,032
Reputation: 30,474

Post » Thu Jul 14, 2016 9:14 am

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.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
289
S
112
G
94
Posts: 7,333
Reputation: 69,287

Post » Thu Jul 14, 2016 9:30 am

SoldjahBoy wrote: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

Image here - http://imgur.com/a/jotze
B
45
S
13
Posts: 118
Reputation: 3,251

Post » Thu Jul 14, 2016 10:47 am

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 :D
B
45
S
13
Posts: 118
Reputation: 3,251


Return to How do I....?

Who is online

Users browsing this forum: darkrealos, Rhindon and 14 guests