How can I setup a looping animation in blender game engine? How can I create a logic brick setup for a looping animation of an object going back and fourth?

For example, I want my object to start along the y axis at position 0, and move 0.1 units over 120 logic ticks. Then, over the next 120 logic ticks, I want my object to move back along the y axis to position 0, effectively creating a looping back and fourth animation.
you can use the action actuator set to ping pong. It plays the animation once through properly, and then plays it backwards. The tricky thing here is the correlation from frames to logic ticks. If you left the default settings, there will be 60 logic ticks per second, and 20 frames per second. 120 logic ticks is exactly 2 seconds worth, so we need 40 frames to be 2 seconds worth of frames. make an animation of your object that is 40 frames long.



On the action actuator, set the start frame to frame 0, and the end frame to frame 40. Now, your animation will play through from frame 0 to 40, then will play it backwards from frame 40 to frame 0, looping endlessly.