I'm very new to the spriteBuilder and cocos2d, which means I'm fairly certain I am doing something wrong... I just don't know what.
I've added a CCNode into a "level-scene" that I load as a child scene to my "gameplay scene", but I can't seem to figure out how to reference the CCNode that is in the level scene.
Kind of like this:
Gameplay scene (CCScene)
Level1 scene (CCScene)
Target (CCNode)
And then in my code I do:
gameplay = [CCBReader loadAsScene:@"Levels/Level1"];
And then I want to get the position of my target which I've placed inside the Level. How would I do that? It has a "doc root var" but I can only access that inside a custom "target"-class. How do I access that inside gameplay? This bit of code gives me {0, 0} when run from gameplay but {393, 193} when run inside the target class.
NSLog(@"Target pos = %@", NSStringFromCGPoint(_target.position));
I am sorry if this is confusing, I'll try to make it clearer. And sorry if it's a stupid question, I am just getting started.
Thanks for any and all help.
Edit: Logging [self children] on gameplay gives:
("<CCSprite = 0x993e670 | Rect = (0.00,0.00,500.00,281.50) | tag = | atlasIndex = -1>",
"<CCSprite = 0x9c9a350 | Rect = (68.00,0.50,32.00,25.50) | tag = | atlasIndex = -1>",
"<CCPhysicsNode = 0xba3a220 | Name = >",
"<CCButton = 0x9c9db20 | Name = >",
"<CCButton = 0x9ca33e0 | Name = >",
"<CCLabelTTF = 0x9ca5320 | FontSize = 50.0>",
"<CCButton = 0x9ca6010 | Name = >",
"<CCButton = 0x9ca7f50 | Name = >",
"<CCSlider = 0x9caa060 | Name = >",
"<CCLabelTTF = 0x9caeed0 | FontSize = 16.0>",
"<CCLabelTTF = 0x9cafa10 | FontSize = 15.0>",
"<CCSprite = 0x9cb02f0 | Rect = (107.50,29.00,75.00,64.50) | tag = | atlasIndex = -1>",
"<CCSprite = 0x9cb08c0 | Rect = (107.50,29.00,75.00,64.50) | tag = | atlasIndex = -1>",
"<CCSprite = 0x9cb0e90 | Rect = (107.50,29.00,75.00,64.50) | tag = | atlasIndex = -1>",
"<CCLabelTTF = 0x9cb1460 | FontSize = 50.0>")