I finally made a module of some very useful bge functions. These I use in nearly every script I’ve ever written.
Inside the zip are both the module and the documentation for it.
You’ll need to have a basic knowledge of python to use these properly.
To use these functions:
import common
#Get an object from inactive layer with property bullet
common.getFunct.objectFromProperty('bullet', 'LevelScene', 'Inactive')
Version 1: Features:
Objects from name
Objects from property
Children from property
Scene from name
Percent
Angle between two objects
Line of sight between two objects
Get all addObject actuators
Activate a list of actuators
Game Path
Game Path up a level (if you are running from inside a data folder)
@OTO:
None of these functions can be used outside of another python script, so I can’t really give examples of how to use them.
@Xjazz:
Yes each function is short, but they are used very often, hence it’s function. In multi-script games (like DEEP Space, where I have ~8 scripts), I use these functions in all of them, and don’t want to have too many duplicates to maintain.
I am planning some longer ones, like my ‘getBestToTrackTo’ function. It just needs some cleaning up to fit in with the rest of the module.