Code: http://pastie.org/1821516
In the snippet referenced above I’ve trimmed most everything out leaving what should be a fairly simple block of code showing my problem.
in game.lua I create the variable gameIsActive. After doing so I
Cannon.require(“cannon”)
Cannon.gameIsActive = gameIsActive
This gameIsActive variable is updated by a pause button; while gameIsActive == false transitions are paused, touch handlers shouldn’t work, etc.
The problem is that upon tapping the pause button, which is defined in game.lua where gameIsActive is initially declared, the value of gameIsActive within Cannon is never updated. I’m still able to fire projectiles as if the button was never pressed.
Do variables within closures not get updated like normal? Any other variables that I assign into Cannon in this manner are properly updated as they change elsewhere in the program. [import]uid: 50570 topic_id: 9194 reply_id: 309194[/import]