I am trying to use the sample code posted by rayman1900, (http://developer.anscamobile.com/code/angry-bird-catapult-simple-pool-example)
I am trying to access an object in a module from main.lua ,
the object is bullet which is in file projectile.lua, and in main.lua,
I have :
local projectile = require(“projectile”)
catapult.newCatapult(_HW-20,_H-40, 60, 0, 30, 0, “targetRouge.png”)
print( "name: " … bullet.name)
in projectile.lua,
I have :
module(…, package.seeall)
local bullet = display.newImage(“my.png”);
bullet.name=“xyz”
In main.lua, I added print( "name: " … bullet.name), but corona prompts :"main.lua:43: attempt to index global ‘bullet’.
I like to access the bullet from main.lua, and do the collision detection, when bullet hits something, I can detect the collision and process the collision.
How can access an object in a module from main.lua ?
Thank you in advance…
[import]uid: 83418 topic_id: 16739 reply_id: 316739[/import]