share a variable or parameters across multiple modules.

Hi

I’m making a game in which the user can unlock levels. on each level is the physical geometry making up the boundaries and multiple objects called from their own modules such as collectibles, gun turrets, enemies and so on.

How can I share “player1” so that it can be seen by the turrets in the scene? The code to detect the player/hero, rotate the turret, fire at the player etc is by necessity included in the turret.lua, so Corona gives me an error when looking for “player1” because the player isn’t called until a level is chosen.

My question is really about best practice, passing parameters and/or variables to external modules and back again. How do others overcome this issue?

Thanks everyone.

Dan

[import]uid: 67933 topic_id: 27278 reply_id: 327278[/import]