私のシーンでは
//.h
#import "cocos2d.h"
#import "FixedBackground.h"
@class FixedBackground;
#import "JoinedMapsLayer.h"
@class JoinedMapsLayer;
@interface JoinedMapsScene : CCScene {
FixedBackground *fixedBackground;
JoinedMapsLayer *joinedMapsLayer;
}
@property(nonatomic, retain) FixedBackground *fixedBackground;
@property(nonatomic, retain) CCNode *joinedMapsLayer;
+(id) scene;
- (void) moveBG:(float)x andY:(float)y;
- (int) getInt;
@end
//.m
#import "JoinedMapsScene.h"
@implementation JoinedMapsScene
@synthesize fixedBackground;
@synthesize joinedMapsLayer;
+(id) scene {
// 'scene' is an autorelease object.
CCScene *scene = [CCScene node];
// 'layers' are an autorelease object.
JoinedMapsScene *layer1 = [JoinedMapsScene node];
// add layers as a childs to scene
[scene addChild: layer1];
return scene;
}
-(id) init {
if( (self=[super init] )) {
fixedBackground = [FixedBackground node];
joinedMapsLayer = [JoinedMapsLayer node];
// add layers as a children of the scene
[self addChild:fixedBackground];
[self addChild:joinedMapsLayer];
}
return self;
}
- (int)getInt {
return 100;
}
- (void) dealloc{
[super dealloc];
}
@end
joinMapsLayer initメソッドで、getIntを呼び出して、値100を返そうとしましたが、0が返されます。
NSLog(@ "%d"、[(JoinedMapsScene *)self.parent getInt]);
なぜこれが起こっているのかについての手がかりはありますか?シーンが間違って書かれていませんか?