How do you loop an animation with one key press?

Hello, I’m new to how the game engine works, so any ideas would be greatly appreciated.

I already have a range of frames from an action looping with an ‘Always’ actuator, and I also have the key ‘D’ setup to play a different range of frames from the same action. However, if I Let go of the ‘D’ key, the 2nd frame range finishes playing and then it goes back to looping the 1st frame range.

My Question: Is it possible to have the animation continue looping the 2nd range of frames, WITHOUT holding down a key on the keyboard? In other words, I just want to tap the key ONE time to have a different range of frames loop forever.

Thanks a lot!
This is a lot of fun to work with!
: )

Okay, I found a way to do it, but it might not be the simplest. I can have the different looping animation frame ranges set to different states, and then just assign different keys to switch between the different states. This should work unless you anyone knows something easier.

Thanks a lot!

keypress-------------and-----------toggle Property “Flip”
time=0---------------/ -----------property time=30

it time min:1 max:30-------and------add-1 to time

if Flip=True----------and-------action ->Loop 2


BooleenyGenie.blend (433 KB)

Wow, thank you so much!

This will be a big help!

: )

This might help:

How to: create Action sequences with logic bricks - the power of the ActuatorSensor

Fantastic, thanks a lot! :slight_smile: