Hi
We are attempting to pass variables between scenes however when we do
CMenuLayer *menuLayer = (CMenuLayer *)self.target;
then we reference the functions, eg. GetVolumeLevel based upon menuLayer
Any ideas please?
A fast, easy to use, free, and community supported 2D game engine
Hi
We are attempting to pass variables between scenes however when we do
CMenuLayer *menuLayer = (CMenuLayer *)self.target;
then we reference the functions, eg. GetVolumeLevel based upon menuLayer
Any ideas please?
You can do this with global variables, or passing a reference with parameters to desired class.
I hate global variables :( and would prefer to just have access to so called public functions where we need as this keeps our code much tidier. There must be a way
As right now the menuLayer is nil as it deallocs the CMenuLayer class upon the replaceScene method
I'm not sure what your question or problem is because your original post doesn't even present either a question or a problem. I think you lost your train of thought halfway through your post.
The easiest way to reference a scene's function is to, when you create the scene, simply store a reference to it.
MyScene *myScene = [MyScene node];
[myScene someMethod:someParam];
myScene.someProperty = foo;
[[Director sharedDirector] runWithScene:myScene];oops I did get lost lol, and will repost question later today via same post.
You must log in to post.