Hi, I am learning Objective-C and have hit a snag.
I have created a custom object called "Baddie". I am trying to add the object to a couple of mutable arrays.
Baddie *b1 = [[Baddie alloc]initWithTag:4444 pos:cpv(450,270) dir:cpv(0,1)];
[baddieArray addObject: b1];
[baddieWaitingArray addObject: [[Baddie alloc]initWithTag:4447 pos:cpv(450,270) dir:cpv(0,1)]];
[baddieWaitingArray addObject: [[Baddie alloc]initWithTag:4448 pos:cpv(450,270) dir:cpv(0,1)]];
//end
At "end" both arrays appear to be empty. The arrays were previously initialised as follows:
baddieArray = [[NSMutableArray alloc] init];
baddieWaitingArray = [[NSMutableArray alloc] init];
I'm not sure why the arrays are empty. The pointer to b1 is still pointing to the object. I can still retrieve properties from it. Where have I gone wrong?