将数字分配给cocos2d中的某个级别

问题描述 投票:0回答:1

我想创建一个方法,将数字添加到另一个数字。这个数字将被分配到游戏级别,随着数量的增加,游戏变得更加困难。在每个级别结束时,我将使用此方法,因此级别编号将上升。我知道这很简单,我似乎无法理解它,不要笑!

ios xcode cocos2d-iphone
1个回答
0
投票

所以你想要一个增加ivar的方法?

@interface Game : NSObject {
    NSInteger level;
}
@property (readonly) NSInteger level;
- (void)nextLevel;
@end

@implementation Game

@synthesize level;
- (void)nextLevel {
    level++;
}
@end
© www.soinside.com 2019 - 2024. All rights reserved.