没有cocos2D的xcode iphone粒子

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

问题描述

是否可以在不使用 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];

}

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

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

iOS VoiceOver functionality changes with Bundle Identifier(IOS画外音功能随捆绑包标识符而变化)
Pushing UIViewController above UITabBar(将UIView控制器推送到UITabBar上方)
java.lang.IllegalStateException: SimpleTypeImpl should not be created for error type(异常:不应为错误类型创建SimpleTypeImpl)
Android IllegalArgumentException: The tag for fragment_XXX is invalid. Received: layout-sw600dp/fragment_XXX_0(Android IlLegalArgumentException:Fragment_XXX的标签无效。收到:Layout-sw600dp/Fragment_XXX_0)
iOS convert audio sample rate from 16 kHz to 8 kHz(IOS将音频采样率从16 kHz转换为8 kHz)
Enforcing an audio sampling rate in iOS(在iOS中强制音频采样率)