For the light itself you can't, but you can fake it using a physics object with the light shape and detecting this object through collision. The file below is a working example, and contains the instructions below on the Text Editor for convenience.
Use the Outliner to click the described object and check the given properties.
- 'player' objects in the first layer, all added to the group 'player'.
- 'box' objects in the second layer, all added to the group 'box'.
- 'ground' and 'walls' are mesh objects.
- The 'player' is a group instance of the group 'player' from the lib scene.
- The 'boxes' are group instances of the group 'box' from the lib scene.
Check the Outliner for a better overview of the structure of the player.
- Object 'flashlight_lamp_collision' is a mesh object parented to 'flashlight_lamp', and it contains the following properties:
- Property 'flashlight' to be detected by the boxes.
- Physics type Static, Ghost enabled, Invisible enabled, Collision Bounds set to Triangle Mesh.
With these options, this object can be detected by the 'box_sensor' objects.
Check the Outliner for a better overview of the structure of the box.
With these options, this object can detect the player's 'flashlight_lamp_collision' using a collision sensor.