android - 这种安卓游戏下雨效果是怎么做的?求思路
伊谢尔伦
伊谢尔伦 2017-04-17 17:50:57
0
7
873

这种下雨效果是怎么做的?求思路

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(7)
迷茫

In the Canvas game, for this scenario, the most optimized solution is actually used, because whether it rains or not is not the key to the game, and we are not a game engine, so we generally do this, from simple to complex:

  • Use other tools, such as PS and AE, to let the artist draw a full-screen rain animation picture (note that it is full-screen), and then export the animation into a 1-frame-1 PNG picture
    Use the animation control to draw to In the current scene, just play it frame by frame

  • Use particle system to generate, but particles consume more CPU. Unless used on some key objects, it is really meaningless for this icing on the cake effect

  • For 3D games, such as Asphalt, water drop engines will be specially developed (or purchased) to allow water droplets to have natural effects such as rebound and fusion. Of course, textures can also be used, only under the screen surface, not within the scene.

2D games are generally option 1

So for a scene like the one mentioned by the questioner, it should be stickers, one by one, which is also very efficient. Anyway, the performance of raindrops looping is also reasonable.

PHPzhong

If there is a game engine, it should use particles.

洪涛

Use png to make a partial rain picture, and then control the picture effect with code, test it yourself

迷茫

Particle effect
Each raindrop is a particle, and the particles contain static pictures or several frames of animation.
Each particle has its own coordinates, 2-dimensional speed, and life cycle.
Change coordinates and animation frames as time changes, which is the following Rain effect

Of course, when you go down to the bottom of the screen, you can re-randomize the coordinates and speed and put them in from the top of the screen.

迷茫

There is a snowflake effect here, you can study the source code
https://github.com/jinatonic/...

迷茫

Do it with svg. Please refer to Baidu for details

PHPzhong

Make a drop of water falling and moving animation, then cycle the width and height of the entire screen, and generate this animation at random coordinate points

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template