I have been following an EggBreaker example to add objects to a display group, but every time I call group:insert(object) the object simply disappears.
I tried adding true to the insert function, but that didn’t do anything.
Tried setting the position of the object before and after adding to the group as well. All the collisions still work with the object added to the display group.
Here is what I currently have (a short version):
local mainDisplayGroup = display.newGroup()
mainDisplayGroup.x = 0
mainDisplayGroup.y = 0
local ground = display.newImage(“Ground.png”, 0, 280)
mainDisplayGroup:insert(ground)
Why are you setting an x/y for the mainDisplayGroup, then the same for the image? That may be the problem. Either remove the x/y for the group or for the image and see how it goes [import]uid: 30185 topic_id: 5722 reply_id: 19590[/import]
If you add an image to a display group they will be drawn first, and if you have any images that weren’t added to any display group they will be drawn last or on top.
In my case I had a background image that was not in a display group so it was drawing on top of the ground.