Here’s my situation. There’s a game.lua file containing composer. A local variable turret object is instantiated in scene:create() function. There’s a method called shoot() that requires coordinates of the turret, which is not within the scope of scene:create(). I’d like to call in turret coordinate using the run time to listen for touch, but when the touch is performed, I receive an error saying that turret is nil in the method.
How should I alter the scope of the turret instantiation in scene:create() such that the function, shoot(), can access the x and y coordinates of the turret?