In my game I use a simple script to change an objects state when the player collides with it. This way the object doesn’t have to constantly check for collisions until I actually need it to.
I pieced this script together from resources I found online. I understand python enough to piece things together but to just sit down and write a script is where I struggle. Here is the collision script.
cont = bge.logic.getCurrentController()
own = cont.owner
collision = cont.sensors['Collision']
if collision.positive:
objects_list = collision.hitObjectList
if objects_list:
for obj in objects_list:
obj.state = 16384
Now I realize that It would also help my games performance if I could set the state of all of an objects children. I looked around on here and else where on the web and found a few examples that I think do what I want but they all do it in a different way and I feel like there should be a method that is as short as the way I do it for collisions.
I don’t want this script to work off of collisions. I want the script to affect its own children, not the ‘hitObjects’ children if that makes sense.
Thanks in advance for any and all help.