To me this feels like a basic and crucial feature for making anything in BGE. But I still haven’t been able to find out how it’s done, and hopefully it can be done via logic bricks somehow.
There are a lot of cases where you need to reference objects in actuators. However, you’re only allowed to choose an object already in the scene before BGE starts. You can’t use other logics to define an object, then reference that as an object to act upon. Or can you?
Here’s a simple example: Let’s say that when I press the Space key, I spawn a cube in a random location, and can spawn an infinite number of cubes. Those cubes have a game property called is-a-cube. In the middle of the scene there is a sphere. When I press Enter, I want the sphere to attach itself to the cube closest to it. It must do so by scanning the area for objects with the is-a-cube property. So: I select the sphere, add a Keyboard sensor for the Enter key, link it to an And controller, and link the controller to a Parent actuator. Now comes the problem: The “Parent Object” field of the actuator asks me for an object that’s already in the scene. I must tell it “the object named Cube.001”, not “the nearest object which has the game property is-a-cube” like I’d need to.
Do game logics allow for a way to get around this limitation? Can a set of logic bricks be used to detect an object, put it in a game property, then use that property in the Object field of an actuator? Or can actuators only be given the name of an object in the scene, and only scripts can be used if you need to detect an object dynamically?