[Noob (I think)] Start animation in python code?

Greetings Community.

Apologies if this question is noobish, one could call me a BGE novice :wink:
When my little protagonist is standing still, I want to add a nice animation to make it seem like he’s just chillin. I have my animation all ready, but I realize I have no idea as to actually initiating the animation.

I have a single script attached to an always sensor in a sort of “creater” empty (my years of GameMaker have taught me controlling things with the GUI is more trouble than it’s worth), so if I could do this entirely in python I would be very happy. Of course, feel free to be critical of this method. Help is very much appreciated.


For something as simple as what you want, logic bricks are probably better; you can just add an idle animation that’s lower priority than all the other animations, so when nothing else is playing it defaults back to that one. Just connect an always sensor to the action actuator and turn the priority number way up (the higher the number, the lower the priority… just roll with it)

You shouldn’t run an action actuator all the time - if you want to blend between actions, I believe the mesh will snap (it won’t blend). Also, I would assume that he wouldn’t have just one or two animations. If he wishes to use Python with multiple animations, it’s not complex to learn.

Connect Action actuators (only available in armature objects) set with the action you wish to play.




to activate and deactivate Action actuators. So, if he’s not moving, deactivate all actions and activate the idle one.

there is no reason to use python as long as it remains as simple as you describe. Do what Captain Oblivion wrote.