I have a small and simple SpriteKit Game that is based on a little animation. Basically, every time the screen gets tapped I want a circular shape to grow out of the place being tapped. I now have the following code:
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
/* Called when a touch begins */
NSLog(@"Touched the screen");
for (UITouch *touch in touches) {
CGPoint location = [touch locationInNode:self];
///NSLog(@"Location X is %f", location.x);
//NSLog(@"Location Y is %f", location.y);
SKSpriteNode* sprite = [SKSpriteNode spriteNodeWithColor:[SKColor purpleColor] size:CGSizeMake(25, 25)];
sprite.position = location;
SKAction *action = [SKAction scaleBy:10 duration:0.5];
SKAction *newaction = [SKAction fadeAlphaTo:0 duration:0.5];
[sprite runAction:action];
[sprite runAction:newaction];
[self addChild:sprite];
}
}
The thing is that the shape that gets created when tapping is a square. Is there any way I could make it a circle?
Also another thing I am dealing with is the color. I set the color to purple. What would be perfect is the color of the shapes appearing being a random color out of a group but I do not know how to do that either.