Display group order reversed after using director.

Prior to using director, I arranged my game so that the order would be as follows:

local group1 = newGroup();  
-- Insert stuff externally via creating enemies from functions.  
  
local group2 = newGroup();  
-- Insert other graphics.  

So from my knowledge, group 2 graphics should appear on top of group1 which was the case. This occurred before I implemented director to create a menu for my game.

Then once I tested the game after implementing director, I noticed my groups weren’t functioning properly, i.e. the order was reversed, so as a test I reversed the order, i.e. put group2 above group1 in code and my code worked as I wanted.

Any reason why this would happen? I’m glad it works, but I find it very strange as to why it works.

Edit: Remove the later post, it is identical, I didn’t mean to double post. [import]uid: 116225 topic_id: 21306 reply_id: 321306[/import]

hi, just out of curiosity, did this return any errors for you on devices? I’m having a problem with director as well that I have posted about. I’m still searching for a solution and wanted to get more insight on your problem to see if i could be having the same issues.

Joey King

Crayotic Games [import]uid: 97844 topic_id: 21306 reply_id: 84710[/import]

Hi there, I have not had the chance to test on devices as of yet, I’m hoping tomorrow I will get the chance to test it out though. [import]uid: 116225 topic_id: 21306 reply_id: 85099[/import]

If you are using Director, each scene must return a single display group.

From what I can tell you are going to need one overall group that you return that contains your two groups in the order you want…

Something like this:

  
new = function ()  
  
 local mainGroup = newGroup();  
  
 local initVars = function ()  
  
 local group1 = newGroup();  
 -- Insert stuff externally via creating enemies from functions.  
 mainGroup:insert(group1)  
   
 local group2 = newGroup();  
 -- Insert other graphics.   
 mainGroup:insert(group2)  
  
 end  
  
 ------------------  
 -- INITIALIZE variables  
 ------------------  
 initVars()  
  
 return mainGroup  
  
end  
  

Hope that helps,
Croisened

[import]uid: 48203 topic_id: 21306 reply_id: 85102[/import]