[Request]Using layer name directly

0 favourites
  • 8 posts
  • Hi admin,

    I try the beginner tutorial.

    Layer 0 is background.

    Layer 1 is Main.

    When we set event details, we use layer 1 instead of Main.

    Why not using the layer unique name "Main" directly?

    If we rearrange the order of layer, the event details still use layer 1 which become background.

    Request:

    1. use layer name directly (recommended), or,

    2. whenever we re-arrange the order of layer, C2 will search through all details and replace with correct layer automatically

    Similary, could we give image point a meaningful name? eg. front / center/ etc.

    Thanks for attention.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can use "layer name" in expressions

    ie.

    Sprite: Move to layer "Main"

    Same with image points, You can use string for image points.

  • You can use the names directly, you just need to put them in quotes in your events to use them. Works fine for me. Set Layer to "Main" works just fine.

    Ah, shinkan got it in before I did...

  • His request #2 is still valid though

    "whenever we re-arrange the order of layer, C2 will search through all details and replace with correct layer automatically"

    I also had to spend some time to fix errors after rearranging/adding/renaming layers because of this

  • Thank you.

    You can use the names directly, you just need to put them in quotes in your events to use them. Works fine for me. Set Layer to "Main" works just fine.

    I will try to check this because tutorial informs us to use number.

    His request #2 is still valid though

    "whenever we re-arrange the order of layer, C2 will search through all details and replace with correct layer automatically"

    I also had to spend some time to fix errors after rearranging/adding/renaming layers because of this

    This is very time-consuming and error-prone!!!

    Please consider this request.

  • lemo sammyconstruct

    If you use the string name of the layer (not its number) ordering the layers again still works.

    Considering your example :

    Layer 0 is "Background".

    Layer 1 is "Main".

    If you refer in your code to the layer "Background" (not 0), changing the order of the layers to

    Layer 0 Main

    Layer 1 Background

    Already keeps the correct "link" to the layer ("Background" is "Background" whether it's layer 0 or layer 1)

    Or have I misunderstood what you're talking about ?

    If so please give more details and precise steps considering your issue.

  • Hi Kyatric ,

    Exactly. I got it now. <img src="smileys/smiley32.gif" border="0" align="middle" />

    I think the problem that lemo mentioned related to number instead of string. Using string solve all problems. I will double-check this.

    Please update the beginner tutorial to use string because the new users will have bad habbit at the beginning for using number. They should start with right habit. String must be used as default standard.

    <img src="smileys/smiley18.gif" border="0" align="middle" />

  • Kyatric

    I also had to spend some time to fix errors after rearranging/adding/renaming layers because of this

    I was talking about layer numbers for the "rearranging/adding" issues

    And layer names for the "renaming" issue

    So there's still a problem in both cases

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