问题
is it possible to have particles without using cocos 2D. I know particle designer but we have to use it with cocos 2D. How can I make particles without cocos 2D ??
回答1:
You can do it by spawning an image and adding it to an array, which makes it extremly easy to animate the image or do whatever with it.
- (void)createImage {
UIImageView *Image = [[UIImageView alloc] initWithFrame:CGRectMake(arc4random() % 320, 480, 40, 40)];
[Image setBackgroundColor:[UIColor blackColor]];
[self.view addSubview:Image];
[myArray addObject:Image];
}
That creates a black image wherever and adds it to an array.
Then, you can make a timer and spawn the image every second!
spawn = [NSTimer scheduledTimerWithTimeInterval:1.0/3 target:self selector:@selector(Spawn) userInfo:nil repeats:YES];
- (void)Spawn {
[self createImage];
}
回答2:
You want to go right to 71Squared. He provides videos of creating a very cool particle engine without Cocos2d. Then, once you have your particle emitter workin, you can go ahead and create a simple class to store the particle sets if you want - I did this for my app.
来源:https://stackoverflow.com/questions/5706096/xcode-iphone-particles-without-cocos2d