How can I get access to information of the CCSprite inside of an array such as x and y positions?
This is my code at the moment and it returns the values of 0 all the time and I don't know why.
for(int i = 0; i < 10; i++)
{
[bulletsBuilder addObject: [CCSprite spriteWithFile:@"bullet.png"]];
}
if(bulletNumber < 10)
{
((CCSprite *)[bulletsBuilder objectAtIndex:bulletNumber]).position = ccp(blob.position.x, blob.position.y);
[self addChild:((CCSprite *)[bulletsBuilder objectAtIndex:bulletNumber])];
NSLog(@"X Position: %i", ((CCSprite *)[bulletsBuilder objectAtIndex:bulletNumber]).position.x); // Returns 0 for some reason
NSLog(@"Y Position: %i", ((CCSprite *)[bulletsBuilder objectAtIndex:bulletNumber]).position.y); // Returns 0 for some reason
bulletNumber++;
}
Thanks.