learning to program blender games with python


I’m pretty new to using the blender game engine, and I’m having a hard time finding any tutorials on programming examples using python scripting. I’ve browsed through the forums and looked on google, but from what I can tell there isn’t much out there. The only luck I’ve had, is from downloading game/demo .blends others have made and trying to decipher what they have done. I also bought the 2.3 guide, but there is no information on the game engine :frowning:

I understand the logic blocks and I know that a lot of functionality can be done using them… but I’m looking for actual code examples/tutorials.

Can anyone point me in the right direction?


Best thing is to download other scripts, work through it and work out what each line is doing, then try some simple stuff like writing the python code for an ‘and’ controller using if and else.

Look in the sticky topic on this forum.

Maybe you already know it but, just in case, here is a link to a complete reference(with some examples):
Documentation for the GameLogic Module

I looked in the sticky post, and did a search for “python”, the best 2 links (I could find) were:


while there is a lot of good material on those sites, it seems outdated. I couldn’t get some of the examples to work at all.

I have been looking at the official documentation at:

and it’s a good reference, I was just hoping for some more current examples.

A similiar post.

Also python is self documenting with the doc string. This would be useful in finding out functions of modules and their parameters. Although the implementer as to actually write the string itself. Not sure if this is the programming style with BlenderPython.

def foo():
“This function does absolutely nothing.”