我使用 spriteWithFile 方法定义了一个精灵,提供了一个 120 像素 x 30 像素的 .png
Sprite *trampoline = [Sprite spriteWithFile:@"trampoline.png"];
[self addChild:trampoline];
当我将它添加到我的图层并定位它时,它就是我希望它出现在屏幕上的位置。
trampoline = [Trampoline node];
trampoline.position = ccp(160,15);
[self addChild:trampoline z:0 tag:1];
但是,它似乎没有 contentSize。以下 NSLog 语句:
NSLog(@"Content Size x:%f, y:%f", trampoline.contentSize.width,trampoline.contentSize.height);
给出以下读出:
2009-07-10 18:24:06.385 TouchSprite[3251:20b] Content Size x:0.000000, y:0.000000
我错过了什么吗?那不应该是 120.000000 乘 30.000000
任何帮助将不胜感激。
问候,
富有的