有没有办法让我把[objects objectNamed:@"level"[insert i]"start"];
这是我现在唯一可以做到的方法,但我想用 i 替换它的数字。
CCTMXObjectGroup *objects = [theMap objectGroupNamed:@"level1_oj"];
NSMutableDictionary *start1;
if(i ==0)
{
start1 = [objects objectNamed:@"level1start"];
}
if(i ==1)
{
start1 = [objects objectNamed:@"level2start"];
}
CGFloat x = [[start1 valueForKey:@"x"]intValue];
CGFloat y = [[start1 valueForKey:@"y"]intValue];
levelstart[i]=ccp(((x/2)-i*480),y/2);