Hi there,
Your external objects could query composer to find out what the current scene is and then pass messages from there. Basically:
--Returns the currently active scene local currScene = composer.getSceneName( "current" )
(See this page for more info).
Another option would be to pass a reference to the current scene when you instantiate your player/enemy objects:
So, in the code for your player object:
local public={} --Local variable holding reference to the main scene local sceneObject = nil local function setScene(obj) sceneObject = obj end public.setScene = setScene return public
Then when you instantiate the player object in your scene:
--Pass the current scene playerObject = require("playerObject") playerObject.setScene(thisScene)
playerObject will then have a reference to the current scene. (The syntax on this may not be perfect, I’ve just typed it in, but you get the idea).
Hope this helps,
Simon