There are many skills in 2D games to get a better visual effect, so that the game is more attractive. The most common is to use the Alpha channel to do light, as if you are rotten ;-) We need to come to a novel thing?
Pay attention to the game of new points such as Starcraft, C & C II, using a roof effect after explosion. Let's implement it:
The first is to do some deformations for 2D planes. People feel the three-dimensional feelings. The algorithm is very simple, and there is a special article on the DxGuide homepage explaining the image distortion algorithm. I am lazy here ;-) Here to achieve Specific effects, the key is the production of the deformation mesh. Briefly describe the cloud wind: a plane is made in 3dmax. The unit polygon mesh is 1: 2 rectangle. Here I made a 15X7 grid plane, choose The middle is a concave. Note that in order to handle convenience, we are mapped from the twisted grid to square mesh, rather than commonly used in the 3D engine to three-dimensional spatial multilateral mapping. So we need the same variant The grid also needs to be rotated 180 degrees, that is, when the recess is to be made, the grid data is raised. Then rotate 30 degrees of the camera, turn off the perspective correction (usually our 2D games use this perspective, isn't it? ?). I think you still remember that the grid of our unit is 1: 2, now they look from 1: 1 square. Take this picture render, remember only the RENDER's frame, as if the left The picture you saw. This picture is scaled to 240x112 size, just satisfying the area of each lattice is 16x16. Remember that the side length of the lattice must be 2 integer power, this is related to the deformation algorithm Speed. OK, use the method you can think of to take out the porthots of the lattice on the picture. (I wrote a small program, computer-assisted manual record each vertex) The 2D graphic can be twisted.
Figure 1
The effect of this (Figure 1) will make people feel weird, as if you look at the picture across a dip, there is no feeling of depression. Why? Because when the ground is sailed, the light will change So we also need to have a light map. Look at this picture on the right, the left side of the pit is darker, the right side is bright. When processing, we use the four corners as the basic brightness than the basic brightness, minus the corresponding brightness; Add the corresponding brightness value than the basic brightness. (This processing will be provided in the next version of the soul) through this light processing step. The effect is quite true (Figure 2 ;-) You can download the cloud wind A simple example (70K). Source code is not available because of the next version developed by the wind.