如何创建Android上一个下雨的影响(颗粒)? [英] How to create a Raining Effect(Particles) on Android?

查看:155
本文介绍了如何创建Android上一个下雨的影响(颗粒)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发一个2D的Andr​​oid战略游戏,它运行在SurfaceView,所以我不能(或可以吗?)用LibGdx的粒子系统。我想提出一个下雨的效果,我的目标这样的事情(的 HTTP://ridingwiththeriver.files.word$p$pss.com/2010/09/rain-fall-animation.gif ),我不需要在飞溅的效果结束(虽然这将是一流的,但可能会占用大量的系统资源)。我怎么能做到这一点下雨的效果呢?任何想法?

I am developing a 2d android strategy game, it runs on SurfaceView, so I can't(or can I?) use LibGdx's particle system. And I would like to make a raining effect, I am aiming for something like this( http://ridingwiththeriver.files.wordpress.com/2010/09/rain-fall-animation.gif ), I don't need the splash effect in the end (although that would be superb, but probably would take up a lot of system resources). How could I achieve that raining effect? Any ideas?

推荐答案

最简单的办法是把雨滴与阿尔法一个PNG,并显示在最后。你只需要几帧,使之顺利,但它会吃了一点资源,如果这是一个完整的画面。

The easiest would be to put the rain drops in a PNG with alpha and display that at the end. You would only need a few frames to make it smooth, but it would eat up a bit of resources if this were a full screen image.

如果您不能负担这一点,你可以把每一个不同的雨滴与阿尔法较小的PNG文件,然后显示这个(这些)单PNG(S)多次。这将减少用了很多的记忆,但你的渲染code会变得越来越复杂一点,这取决于你有多少滴有,它可能会影响性能。

If you cannot afford this, you could put each distinct raindrop in a smaller PNG file with alpha, then display this (these) single PNG(s) multiple times. This would reduce the memory used a lot, although your rendering code will get a bit more complex, and depending on how many drops you have, it might affect performance.

两者之间的权衡将是有一个包含更多滴PNG文件,而不是全屏幕,并显示了几次。

A trade-off between the two would be to have a PNG file that contains more drops, but not for the full screen, and display that a few times.

您可以有另一帧(或帧),其中雨滴溅,你可以将结束每一滴的动画之前显示,或者你可以在大PNG的最后一帧包含飞溅。

You could have another frame (or frames) where the raindrop splashed, which you could display before ending the animation of each drop, or you could have the final frame in the large PNG contain the splashes.

这篇关于如何创建Android上一个下雨的影响(颗粒)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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