[Resolved] New objects created don't appear to be in the group I added them to.

I am making a game where I have new objects created as they are needed. Everything looks fine normally, but if I remove the sky background image I can see all of the objects I’ve created stacked on top of eachother in the top left corner (0,0). I am inserting these into the main game group in createScene but for some reason they’re still there. I am also inserting them into the correct group when they are returned.

Here is how I create an object (in this case a cloud):

cloud = objectData.newObject( "cloud", 1 )  
cloud.x = screenWidth\*0.2  
local cloudListGame = { cloud }  

My objectData object stores the resource path, scaling, etc. for the object. I use cloudListGame to generate objects, checking the X location and then creating and placing a new object if needed.

I’ve tried inserting both the cloud object and the reference to the cloud object ( gameView:insert(cloudListGame[1]) ) with no luck, the objects still draw at the top left corner.

The generation and placement of new objects seems to work fine, I think this is also causing a 1MB memory leak when I reload the game, since I am removing whole groups and these seem to not be in groups despite setting them to be.

I’d be happy to post more code or screens.

Thanks in advance for any help!

-Treb [import]uid: 181948 topic_id: 33062 reply_id: 333062[/import]

I have struggled with this for a couple days, and of course I found the solution within 10 minutes of posting :stuck_out_tongue:

Anyways it turns out I was creating the objects in the external generator function where I didn’t need to.

Please mark this as resolved. [import]uid: 181948 topic_id: 33062 reply_id: 131320[/import]

I have struggled with this for a couple days, and of course I found the solution within 10 minutes of posting :stuck_out_tongue:

Anyways it turns out I was creating the objects in the external generator function where I didn’t need to.

Please mark this as resolved. [import]uid: 181948 topic_id: 33062 reply_id: 131320[/import]