physics reverse direction

  • 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.

  • Bumpity bump bump^^?

  • Bump it , Bro !

    Add "trigger once while true" to your collision event

    Edit : I made a lightning post ! :D

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)