Action after arrived

Get help using Construct 2

Post » Sun Feb 09, 2014 7:33 pm

Hey guys, let me just apologize in advance in the case that a similar forum thread exists - unfortunately I have not been able to find it.

My friend and me are making a horror adventure demo in Construct and got stuck on "action after arrived" programming. Let me explain what I mean by that.

We have successfully implemented 8-way character movement and animations while moving in our rooms (e.g. layouts). Now we have a small problem with getting the right event order for our character to change rooms.

We would like to be able to perform this:
1. if mouse (left click) on door (sprite)
2. character walks to door
3. character changes room (e.g. layout)

The movement and the layout change work fine on their own but I cant seem to get the system to wait for the player to arrive at the door before the system goes to the other layout.

I have tried setting another condition that would wait for the player to arrive (path-finding - on arrived) but Construct wont let me combine it with the mouse left-click on door because of triggering issues.

Any help on this would be much appreciated. Let me know if you need any screenshots or more info.


B
7
S
1
G
1
Posts: 16
Reputation: 584

Post » Wed Feb 12, 2014 7:56 pm

...any ideas guys?
B
7
S
1
G
1
Posts: 16
Reputation: 584

Post » Wed Feb 12, 2014 8:04 pm

Seems like you are using pathfinding to move to the door.
Isn't there an on arrived trigger for pathfinding?

You could also use an on collision with door trigger, or is overlapping.
Or you could use a distance check to see if the player is close enough to the door.

so on left click - find path,
on path found - move
on colision with door - switch layout
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Feb 12, 2014 8:30 pm

Hey LittleStain,

that was my initial try. The problem is that I need to combine both conditions to change the layout. Overlapping by itself could happen even without giving the command to change rooms (click on Door sprite).

Do you think that maybe global variables could help? E.g. if click on door (variable changes value to true) and then combine the overlapping with the variable check?

Ill try that right away :)glazba2014-02-12 20:31:07
B
7
S
1
G
1
Posts: 16
Reputation: 584

Post » Wed Feb 12, 2014 8:34 pm

You could give the player a boolean, dooropen, and set it to true on door clicked, and check for that in a condition.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Feb 12, 2014 8:41 pm

Thank you for the idea LittleStain,

the combination of global variable + overlapping works like a charm :)



I am pretty happy with it, maybe its not the most elegant solution, but it works :)

Thanks againglazba2014-02-12 20:41:27
B
7
S
1
G
1
Posts: 16
Reputation: 584


Return to How do I....?

Who is online

Users browsing this forum: asdtricky, Ashley, brunopalermo, ST314 and 34 guests