Click here to Skip to main content
15,884,472 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm working off the sprite template in xcode.

In MyScene.m we have

-(id)initWithSize method where I declare

SKSpriteNode *myArray[widthPixels][heightPixels];

then create a sprite

myArray[i][j] = [SKSpriteNode spriteNodeWithImageNamed:@"orange"];

and add it

[self addChild:myArray[i][j]];

everything displays as expected. later, when I run the method

-(void)mouseDown

i want to do something like this:

[self removeChild:myArray[10][10] cleanup: YES]

but myArray apparently isn't accessible from this method? how do I declare an array of my sprites such that I can keep track of them and remove individual ones at will including in different methods?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900