Stop actor when conditions are not valid
3absh
Member Posts: 601
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
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.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User