physics reverse direction

Get help using Construct 2

Post » Fri Dec 14, 2012 7:36 am

Hello all,

I have a physics character that I'm moving left or right with a force action. The direction is determined by a local boolean.

I would like to have the character reverse their direction when they bump into a wall by toggling its boolean. I set this up by setting an 'on collision' even to flip the boolean. The problem is that when the character touches the wall it almost always gets stuck because the boolean is flipping faster then the force has time to move it away.

Do you know of any way to have a trigger fire then wait and ignore any other triggers until some time has expired? I tried using a wait in the event but it just seemed to delay the flipping a bit(unless I was doing something wrong).

Thanks!

P.S. I'm also not looking to solve this with invisible "detector sprites", sry.
B
37
S
9
G
7
Posts: 143
Reputation: 6,017

Post » Tue Dec 18, 2012 12:37 am

Bumpity bump bump^^?
B
37
S
9
G
7
Posts: 143
Reputation: 6,017

Post » Tue Dec 18, 2012 12:39 am

Bump it , Bro !
Add "trigger once while true" to your collision event
Edit : I made a lightning post ! :D Whiteclaws2012-12-18 00:40:40
B
35
S
16
G
16
Posts: 2,222
Reputation: 16,589

Post » Tue Dec 18, 2012 2:50 am

Close but not quite... I tried your suggestion but the problem is with physics the object might trigger on and off 20 times in one second; hence it getting stuck.

I need a "trigger once" then wait 1 second before evaluating again. I know I can do that with a local variable and toggling it and such but I was guessing there's a simpler solution.

Thanks
B
37
S
9
G
7
Posts: 143
Reputation: 6,017


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, jul, nicklowkcmagic and 19 guests