GameSalad

Stop actor when conditions are not valid

What I need is for when Layer3_Shot attribute is true for the interpolation to stop entirely.
Here it seems the following timed execution stops but doesn't stop the function inside from completing its function

For example
Timer every 10 seconds interpolate actor for 5 seconds
The actor will continue to interpolate even though the conditions are not valid anymore but will not execute at second 20 if the conditions are broken at second 13 for example but the interpolation will continue

Anyway around this?

Comments

  • tatiangtatiang Posts: 10,713
    edited April 23

    Interpolate is a persistent behavior that doesn't stop -- as you discovered -- until it completes. You'll need to do manual interpolation instead. For example:

    When [conditions are true]
         Change attribute self.increase to random(80,220)
         Change attribute self.startingX to self.Position.X
         Timer for 0.5 seconds
              Loop
                   change attribute self.Position.X to self.Position.X+(self.increase-self.startingX)/0.5

    Edit: eh, my math is off. Tired this morning. I think you'd divide by the number of seconds per cycle, so something like 0.03. You may find a better example if you search the forums for manual interpolation or custom interpolation.

Sign In or Register to comment.