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

Get help using Construct 2

Post » Mon Mar 31, 2014 9:53 pm

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!
Last edited by Kazan on Fri Apr 04, 2014 9:55 am, edited 3 times in total.
B
19
S
7
G
10
Posts: 82
Reputation: 4,996

Post » Tue Apr 01, 2014 2:49 am

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.
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,848

Post » Tue Apr 01, 2014 7:49 pm

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!
B
19
S
7
G
10
Posts: 82
Reputation: 4,996

Post » Wed Apr 02, 2014 9:38 am

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
B
19
S
7
G
10
Posts: 82
Reputation: 4,996

Post » Thu Apr 03, 2014 11:16 pm

Bump.

Anyone? :)
B
19
S
7
G
10
Posts: 82
Reputation: 4,996

Post » Thu Apr 03, 2014 11:33 pm

Give each staircase an ID, and the ID of the staircase above and below it. Use U and D to go up or down.
You do not have the required permissions to view the files attached to this post.
ImageImageImage
B
71
S
22
G
247
Posts: 3,753
Reputation: 137,552

Post » Fri Apr 04, 2014 9:54 am

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 :)
B
19
S
7
G
10
Posts: 82
Reputation: 4,996


Return to How do I....?

Who is online

Users browsing this forum: The Mnk and 5 guests