How do I move my character between levels on a world map?

Get help using Construct 2

Post » Sun Jan 18, 2015 2:10 am

This thread is sort of a sequel to a previous thread I made:

viewtopic.php?f=147&t=122741&p=874659

You might want to read that one first, it's only like 3 posts long. I'm having another, separate but similar problem to that one. I previously used the LiteTween plugin to move my map character between map squares on the grid (Mario Bros. 3 style) and it worked well because each button was a separate object that I could point it to move towards, like so:

Image

But I don't know how to make this work with the new system made using the previous thread's solution where the level button is just one object with different instances. Any ideas? Is there a way to, say, point the character object toward the level button that has "atlevel=2" as its value and so on?
B
18
S
9
Posts: 103
Reputation: 1,817

Post » Sun Jan 18, 2015 2:27 am

Just double posting to say that I was messing around with it while waiting for a response and I found a solution by modifying my code as such:

Image

I couldn't figure out how to get it to pick the level button by the variable, so instead I used Pick by UID to select the specific button I want the sprite to move to. Then I do my LiteTween function as before and it moves toward the button.

If anyone has a better solution I would love to hear it, but this is what I've found works for now.
B
18
S
9
Posts: 103
Reputation: 1,817

Post » Sun Jan 18, 2015 3:03 am

IMO you shouldn't use UID. Just have an ID value of your own in each button (say, the corresponding level number) and use that in your picking (i.e. levelButton: ID = atLevel)

edit: as described in other thread?
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Sun Jan 18, 2015 3:25 am

I don't know how to use it for my picking. I did say I was unable to figure it out in my above post.
B
18
S
9
Posts: 103
Reputation: 1,817

Post » Sun Jan 18, 2015 3:29 am

CJacobsSA wrote:I don't know how to use it for my picking. I did say I was unable to figure it out in my above post.


I gave you the code :)

Instead of
levelButton | Pick instance with UID 140


use

levelButton | myLevel = atLevel


I changed 'ID' from previous post to 'myLevel'

edit: if you feel like posting your capx I can have a look
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Sun Jan 18, 2015 4:53 am

Ah, okay, I've got it now. I didn't know you could just do a 'compare variable' condition in that situation! Thank you for the help!
B
18
S
9
Posts: 103
Reputation: 1,817

Post » Sun Jan 18, 2015 5:12 am

CJacobsSA wrote:Ah, okay, I've got it now. I didn't know you could just do a 'compare variable' condition in that situation! Thank you for the help!


no worries, good luck
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596


Return to How do I....?

Who is online

Users browsing this forum: Nicolas951, Shenkai the ssj and 21 guests