cocos2d iphone - Accessing Information on other Layers -
i have 2 layers, game , hudlayer. hud on top of helloworldlayer.
i've got button press reload hudlayer numbers showing on screen capture what's on gameplay.
buttontapped: declared on hudlayer(which goes before helloworldlayer) implementation.
hudlayer , helloworldlayer on same file helloworldlayer.m
i press button and:
- (void)buttontapped:(id)sender { int number = 6; //heres problem //i dont know how change part... [[helloworldlayer]->changednumber = number; ///how give changednumber number's value????? _label.string = [nsstring stringwithformat:@"number: %d",number]; }
helloworldlayer has property:
@property (assign) int changednumber;
sounds sender helloworldlayer.
you can try:
sender.changednumber = number;
Comments
Post a Comment