If I wanted to create an instance of an object how would I go about it?
What I’m trying to do is have a scrolling background. I made it tilable so I could only need one image but I think the way I’m doing it is creating 2 different objects in Corona.
Is there a way to tell Corona to just make a copy of the one I have?
Here’s the code I’m using to create the images:
[lua]–Stars
local stars = display.newImageRect(“stars.png”, 480,320)
stars:setReferencePoint(display.CenterLeftReferencePoint)
stars.x = 0;
stars.y = cHeight * 0.5;
localGroup:insert(stars);
–Stars02
local stars02 = display.newImageRect(“stars.png”, 480,320)
stars02:setReferencePoint(display.CenterLeftReferencePoint)
stars02.x = cWidth;
stars02.y = cHeight * 0.5;
localGroup:insert(stars02);[/lua]
So this is working good for me. I have them so once one of them reaches the end the other one pops up behind it and they just do this back and forth.
New to programming so I feel like everything I’m doing is brute force. [import]uid: 123298 topic_id: 25676 reply_id: 325676[/import]
(See the jungle scene sample code as an example - same thing there.) [import]uid: 52491 topic_id: 25676 reply_id: 103825[/import]