xcode iphone粒子没有cocos2D [英] xcode iphone particles without cocos2D

查看:170
本文介绍了xcode iphone粒子没有cocos2D的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以具有不使用cocos 2D的粒子。我知道粒子设计师,但我们必须使用cocos 2D。如何制作没有cocos 2D的粒子

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 ??

推荐答案

您可以通过产生一个图像并将其添加到数组,

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];

}

这篇关于xcode iphone粒子没有cocos2D的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆