[Resolved] Sending variables to new scenes with director

Hey,

I have been wondering if I could send variables to the next scene as in: you click level one on the level select and it takes you to level.lua (stores data for all of the levels) it pases through the level one variable and it loads level one (not level1.lua)

is this possible to do using director? and if so how could i do this?

Thnx,
ultra [import]uid: 31078 topic_id: 29262 reply_id: 329262[/import]

Yes, it is possible to send parametars to scenes using Director class.

Send parametars:

local params = {  
 score = score,  
 special = special,  
 }  
 director:changeScene(params, "over", "fade")  

Recieve parametars:

local totalScore = params.score  

Daniel [import]uid: 159657 topic_id: 29262 reply_id: 117685[/import]

Moved to “Director Class” sub forum from “Developer Support”. [import]uid: 52491 topic_id: 29262 reply_id: 117695[/import]

Ok so I fully updated my director.lua and it is telling me that it cant find the params from the levelselect.lua when it goes to loadlevel1.lua and i am using the same code that you sent me. [import]uid: 31078 topic_id: 29262 reply_id: 117818[/import]

The code works.

Daniel [import]uid: 159657 topic_id: 29262 reply_id: 119332[/import]

In the scene where you are receiving parametars you need to add:

function new(params)  

Then it works.

[import]uid: 177091 topic_id: 29262 reply_id: 125778[/import]

In the scene where you are receiving parametars you need to add:

function new(params)  

Then it works.

[import]uid: 177091 topic_id: 29262 reply_id: 125778[/import]