# How to change the speed of an action in bge without interrupting the loop?

I have an analog controller and I want to change action speed on the runtime, but without interrupting the loop of the action. I tried this but it doesn't work. The loop restart all the time when the variable_that_changes changes.

armature_object.playAction("run",0,30,play_mode = bge.logic.KX_ACTION_MODE_LOOP, speed= variable_that_changes)


## 1 Answer

I suggest to use skip the automatic play modes and implement an on counter.

You can do this even without python. Define a float property "frame" that is supposed to hold the frame of the pose to be played.

Whenever the property change activate an action actuator in property mode with that property.

Now you can implement logic that manipulates the property frame.

• Just adding "frame" in the action property doesn't work, but adding it also in Frame Property works! Thanks. Modify your answer and I will accept it! – user36531 Oct 14 '16 at 12:02
• Oh sorry I forgot the true level triggering. Now it works! Thank you – user36531 Oct 14 '16 at 12:06
• However it seems working better using the AlwaysSensor with the true level triggering. – user36531 Oct 14 '16 at 12:08
• Using the always sensor is inefficient - unless the property changes all the time. As this is your current situation, it should be fine. – Monster Oct 18 '16 at 5:12