i have different objects and they have all different animations. i can run animations with playAction code seperately. But i want to run animations in an order as when one is end another starts.
for example when i press “show me how” button first objects animation will run, when it ends, second objects animation runs and when it ends last objects animation runs. i need this for a little show me how tutorial in my game.
and another question is there any way to use endObject code with wildcard characters as “* or %” to destroy multiple objects includes same characters. for example i wanna destroy too many objects names ended with “_rgd” like “obj1_rgd”, “obj2_rgd”, “obj3_rgd” and etc. and wanna use scene.objects["*_rgd"].endObject.
thanks Monster. i’ve learnt a lot of things from your tutorails.
i have one more question. i askeing this question to understand logic of blender ge. why blender runs some codes multiple times. for example i added an always actuator to camera and add a module to it. the module has a for loop and a print code to show result on command line. but when i run the game sometimes it prints two times, sometimes three times and sometimes four times but never once.
for i in range(0,7):
ms.objects["btn"+str(i+1)].worldPosition = [d[i],d[i],-5]
In the past I recommended not to mangle “object” as this makes the class “object” not available. Therefore I suggest to use the name “gameObject”. This is more specific towards the content of the variable. Nearly everything in Python is an object, but not everything is a gameObject.
During time I haven’t seen a (bge) use case for the class “object” since ages. Finally as long as the variable “object” remains in local scope I do not see any problem. So if the context tells you you are dealing with game objects and you do not need the class “object” I think it is fine to call a variable “object”.
The plural form “objects” suggests the variable is a container. I expect there is none, one or more objects present and I need to differentiate between processing the container and it’s content e.g. copying, iterating.
When you explicitly know there is exactly one item, it is better to use singular form of the name. This is not always possible with English language (e.g. data, news). In that case alternative names could help.
Naming things can be really hard. E.g we often call variable with a game object “owner”. Why? because it is meant to contain the game object that “owns” the currently executed controller. The term “owners” makes not much sense in that context as we know there is only one owner.
So how do we call a game object? “owner” or “object” or “target” or “hitObject” or “player” or “o”? It depends on the situation and what you as developer want to tell the reader (and yourself). (Btw. the compiler does not care how you name your variables ;))