如何在iOS上制作爆炸动画? [英] How would I make an explosion animation on iOS?

查看:112
本文介绍了如何在iOS上制作爆炸动画?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个iOS游戏,当球击中目标时会爆炸.

I have an iOS game, and when a ball hits a target it explodes.

设置爆炸动画的最佳方法是什么?

What would be the best way to animate this explosion?

推荐答案

如果您正在寻找简单的东西.

If you're looking for something simple.

制作一系列动画来爆炸.将它们添加到UIImageView并开始动画.像这样:

Make a series of images that animate the explosion. Add those to a UIImageView and start the animation. Something like this:

UIImage *image0 = [UIImage imageNamed:@"explosion0.png"];
UIImage *image1 = [UIImage imageNamed:@"explosion1.png"];
UIImage *image2 = [UIImage imageNamed:@"explosion2.png"];
UIImage *image3 = [UIImage imageNamed:@"explosion3.png"];

myImageView.animationImages = [NSArray arrayWithObjects:image0, image1, image2, image3, nil];
[myImageView setAnimationDuration:0.75f];

[myImageView startAnimation];

这篇关于如何在iOS上制作爆炸动画?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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