How do I interrupt an in progress event?

Get help using Construct 2

Post » Fri Jun 20, 2014 4:06 pm

So basically I have an enemy with the platform behavior that will move back and forth between waypoint sprites. When he reaches a waypoint he then PICKS another waypoint at random and then moves towards it, rinse and repeat.

I am trying to get him to stop while he's on his way to a waypoint.

I can stop him once he gets there but if he's already picked the waypoint I can't. I've tried disabling the waypoint group itself, I've tried inserting variables here and there. Nothing seems to work. I can stop him temporarily by disabling his platform behavior, but once I start it back up he just picks up where he left off lol.

It seems like once he's picked the waypoint and the event is running there's no stopping it. I thought about destroying the waypoint he picked, that might work right? But unfortunately for other reasons in the game destroying the waypoint isn't an option.

Any ideas on this one? I feel like I'm missing something fairly simple here.
B
19
S
7
G
10
Posts: 82
Reputation: 4,996

Post » Fri Jun 20, 2014 4:13 pm

What kind is a "waypoint" in your project? And how is the movement handled?

If you can, please provide a capx.
B
15
S
3
G
5
Posts: 396
Reputation: 4,977

Post » Fri Jun 20, 2014 4:30 pm

Sure. I can't post the game but here's a quick mock-up.

https://dl.dropboxusercontent.com/u/349 ... point.capx

It uses a custom behavior by RexRainbow however so you'll need that to open it.

https://dl.dropboxusercontent.com/u/577 ... oveto.html
B
19
S
7
G
10
Posts: 82
Reputation: 4,996

Post » Fri Jun 20, 2014 4:50 pm

Tried the behavior, but I can't figure out your problem.

You need to set the new waypoint to the actual position of the AI when you deactivate the behavior.

Here's the test, the orange sprite is dragabble and the target. Every 1 second the PlatformMoveTo behavior is switched on/off.

shouldmove.capx
You do not have the required permissions to view the files attached to this post.
B
15
S
3
G
5
Posts: 396
Reputation: 4,977

Post » Fri Jun 20, 2014 5:05 pm

Thanks, I see what you're doing there but that's exactly the issue I'm having. As soon as you turn his platform behavior back on he'll pick up right where he left off and continue moving.

I can stop him while he's walking no problem, but I'm looking more for a way to stop the entire movement loop completely while he's walking. Because I want his platform behavior available for other actions.

In the actual game I have for each events on the enemies because there's more than one of them. You would think the stop loop action would work... but it doesn't seem to.

Thanks for helping though, much appreciated.
B
19
S
7
G
10
Posts: 82
Reputation: 4,996

Post » Fri Jun 20, 2014 5:49 pm

Did you try the Controls in my capx? You can use it while the waypoing stays the target already.

The difference is to use the object as the waypoint target, instead of waypoint.x . Once stopped, move a temporary waypoint to the Players position, and set it as new waypoint. So the old target is overwritten.

All right? Here is a simple solution without using rex's behavior, but simulated Keydowns.

shouldmove0.2.capx


Hope it helps.
You do not have the required permissions to view the files attached to this post.
B
15
S
3
G
5
Posts: 396
Reputation: 4,977

Post » Fri Jun 20, 2014 7:25 pm

Thanks, I'll have a look at it. I appreciate the help! :)

Seems very odd to me C2 doesn't have a way to break a loop though.
B
19
S
7
G
10
Posts: 82
Reputation: 4,996

Post » Fri Jun 20, 2014 7:31 pm

It has, but this addon does not support it.
B
15
S
3
G
5
Posts: 396
Reputation: 4,977

Post » Fri Jun 20, 2014 7:52 pm

You're right, it was the addons fault.

On a whim I was playing with while loops. Without the behavior they stop, with it they don't. How strange.

Anyway you were a huge help. Thanks so much for taking the time to help me :)
B
19
S
7
G
10
Posts: 82
Reputation: 4,996

Post » Fri Jun 20, 2014 8:12 pm

No problem, I appreciate finding solutions for every new c2 version (and its possibilities).
B
15
S
3
G
5
Posts: 396
Reputation: 4,977

Next

Return to How do I....?

Who is online

Users browsing this forum: pegasus6464, Yahoo [Bot] and 29 guests