0 Favourites

Set Position to a specific instance object

  • Hello everyone,

    I will try to be clear because I don' know how to explain my issue.^^

    What I'm aiming to is, on Start of layout, to set the position of my Player on a specific instance object. They're several instances of that object on my layout but I can't figure out how to get the coordonnates of the one I want!

    I tried to pick with a instance variable or the UID but nothing works. I read a lot of post about 'selecting a instance' but I think I don't get it....

    And I would like to avoid creating a specific object for each position :(

    If you have any advices in the way to do this, I would be very grateful!

    CAPX example of my issue:

    Capx

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Picking on start of the layout is weird.

    Example:

    On start of layout:

    -[some event that spawns a lot of sprites]

    now in the same event, you can't pick those sprites you've created, no matter how you structure events/subevents.

    workaround:

    On start of layout:

    -[some event that spawns a lot of sprites]

    On start of layout:

    • pick created stuff

    workaround 2:

    On start of layout:

    -[some event that spawns a lot of sprites]

    • : wait dt

    call function "xyz"

    and on function "xyz" called:

    -pick created stuff: do stuff with it

  • mindfaQ Thank you for your answer.

    But my objects are not created by code. They're already on my level design, on the layout in the editor.

    They're just trigger boxes.

    If I understand your proposals, it's only for created objects during the game.

    Or peharps I misunderstand.

  • Could you post a .capx or a screenshot of how you were trying to pick?

  • If they are already there on your layout, you already know the coordinates and could use those directly.

    Or pick by UID, I really don't know what can go wrong there except when you try to pick it in a subevent while in a parent event you've already picked other instances of these objects and the object you wanna pick is not among them.

  • How do you choose the specific instance where you want to put the Player? random? is there a specific condition?

  • I've just uploaded in my first post a link to a CAPX to show what I'm trying to do.

    This is probably a simple thing to deal with but I don't get it on my own! ^^'

  • I know... is just that I am at work and using Linux, so I was trying to help in the meantime hahaha

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