Normally, we activate actuators like this:
controller = logic.getCurrentController()
actuator = controller.actuators['AddObject']
controller.activate(actuator)
This activates the actuator called "AddObject" that belongs to the current controller.
But let's suppose that I want my scene manager to tell objects to delete themselves. The "End Object" actuator has to be on the object to be deleted, not the object that's doing the deleting (unlike the Add Object). I add an "End Object" actuator called "EndObject" to the object I want to end, and then I use:
scene = logic.getCurrentScene()
cont = logic.getCurrentController()
for obj in scene.objects:
if obj.name == "Critter":
obj.actuators["EndObject"]
....
... and then what? Using:
act = obj.actuators["EndObject"]
obj.activate(act)
...doesn't work because obj
doesn't have a function called activate
, nor anything similar that I can find.
Any ideas? Am I using "End Object" incorrectly?