0 Favourites

[SOLVED] How do I move to an instance of an object?

  • Hi there.

    I'm working on making some functional stairs. Something very similar to the stairs in Gunpoint (go play it, it's great!).

    What I have is a "stairs" sprite and a copy of that sprite on a different floor.

    So basically all I want to do is when the player is overlapping that first set of stairs, they press a button, an animation plays and they warp to the copy of the stairs on the second floor.

    I know I could just make separate objects for the stairs and try to do it that way. But if I'm making a large building with varying sets of stairs that would get confusing fast. Knowing how to do it would help me with a lot of other instances in my project as well.

    Help on this would be huge.

    Thanks!

  • You could make different ways, but here are two examples.

    1.

    Make use of the stairs UID.

    Floor_Up = Hold the UID of the the stair that it leads to on the upper floor.

    Floor_Down = Hold the UID of the the stair that it leads to on the lower floor.

    2.

    Give each stair a variable that identify them instead of the UID.

    Stair_ID = <Stair_ID>

    Floor_Up = Stair_ID to where it leads

    Floor_Down = Stair_ID to where it leads

    Stair_ID could be formatted so is holds the floor nr and a letter if there are more stairs on the same floor.

    Example: "2a" would be the first stair on the second floor, "2b" the second stair.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Ahh, that's an interesting way of doing it.

    I think I'll give your second option a shot as I think that will work a bit better for my needs. Thanks a lot for taking the time to help

    Nice looking out there too for separate sets of stairs on the same floor, that was going to be my next question ha.

    Thanks again!

  • Well I'm having some issues getting both of these ways to work.

    At first it seemed easy but I'm not sure how to write this out exactly with events, it just goes back to my original problem of how to actually move to an instance. The second example especially, how can I actually pick an object with variables?

    Could anyone post a capx or go into more detail? Been struggling all night with this one lol

  • Bump.

    Anyone?

  • Give each staircase an ID, and the ID of the staircase above and below it. Use U and D to go up or down.

  • Thank you so much. That's such a clean and elegant way of doing this. I was using a completely different expression, it was getting me nowhere but I couldn't think of what else to try. I really need to become more familiar with picking.

    Thanks again, big help

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