CCLabelTTF
次のようにandを使用することをお勧めしCCAction
ます。
- (void) typeText
{
static NSUInteger currentCharacter = 0;
// Your instance variable stores the text you want to "type" in it:
_text;
// Sorry, I can't remember substring functions, this is pseudo-code:
NSString *substring = [_text getSubstringFrom:0 to:currentCharacter];
// Also can't remember how to get length of a string (yipes)
NSUInteger stringLength = [_text length];
if (currentCharacter < stringLength)
{
CCSequence *loop = [CCSequence actions:[CCDelayTime actionWithDuration:0.3f],[CCCallFunc actionWithTarget:self selector:@selector(typeText)],nil];
[self runAction:loop];
}
}
これはテストされていないコードです。また、typeText
関数が のサブクラスで実装されていることを前提としてCCNode
います。[self runAction:]