Okay. I've been working on this 2D Platform game in the Blender Game Engine lately. I've added some basic motion functions (in Python code), and now I'm getting to animation. I'm using the Blender playAnimation() function, and it works. But, I've found with logic bricks that the animation type that works best in my game is the flipper type. playAnimation() has no flipper mode.
Here's my script so far: (without playAnimation() function in it)
import bge
import math
def main():
cont = bge.logic.getCurrentController()
own = cont.owner
keyboard = bge.logic.keyboard
xyz = own.localOrientation.to_euler()
xyz[2] = math.radians(180)
if bge.logic.KX_INPUT_ACTIVE == keyboard.events
[bge.events.RIGHTARROWKEY]:
own.applyMovement((0, 0.08, 0), True)
own.worldOrientation = (0, 0, 0)
if bge.logic.KX_INPUT_ACTIVE == keyboard.events
[bge.events.LEFTARROWKEY]:
own.applyMovement((0, 0.08, 0), True)
own.localOrientation = xyz.to_matrix()
if bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.SPACEKEY]:
own.applyMovement = ((0, 0, 0.08), True)
main()
So, how could I allow flipper animations in this script? Thanks!!
P.S. This code is for a public game project (or several). While I'll really appreciate any code or tips offered, I may or may not be able to give credit for it.