I have begun learning to program Corona by looking at the code of my developer. I am coming along nicely but still lots to learn.
Anyway,
I have this function
function scene:create( event )
local sceneGroup = self.view
local mycircle = display.newCircle(50,50, 25)
local text = display.newText(“ABCDE”,50,50,Helvetica, 14)
text:setTextColor(0,0,1,255)
mycircle.id = “ABCDE”
sceneGroup:insert(mycircle)
sceneGroup:insert(text)
end
and I understand it. However, if I want to do something like this…
function scene:create( event )
…
level1(arg1, arg2, arg3)
level2(arg1, arg2, arg3)
…
end
function level1(one, two, three)
local mycircle = display.newCircle(50,50, 25)
local text = display.newText(“ABCDE”,50,50,Helvetica, 14)
text:setTextColor(0,0,1,255)
mycircle.id = “ABCDE”
--sceneGroup:insert(mycircle)
--sceneGroup:insert(text)
end
I don’t know how to do it, since I no longer have the scene group.
Or am I going to have to create another Lua file and let that scene:create(event) create the circles?
I already thought of that and I can do it that way, just wondering if that is the best or only way to do it?
Note: I will be creating lots of circles.
Other questions if you don’t mind. When you randomly create the circles, how do you make sure you don’t create one on top of another? I mean I can manually calculate where to put them, but if I want to just randomly do it. Also, can I create them ABOVE the device and let gravity let them fall into the screen?
Thank you in advance for any help you can provide me.