domingo, 5 de julio de 2009

Hacer Reflejos / Making Reflections

Después de pensarlo he hallado la manera de hacer un reflejo del protagonista sobre una superficie de suelo. Los pasos que he hecho son los siguientes:
1) Eliminar en el fondo (en mi caso Lihr) toda el agua y ponerla transparente (yo uso el magenta). Un ejemplo sería así:
Y esta imagen la cargamos en el fondo número 2, también se podría cargar en el 0 o en el 1. Yo lo cargo sobre el dos porque sobre el primero tengo la imagen de Lihr con las partes que hacen que el protagonista desaparezca de la pantalla: árboles y las señales.

2) Ahora hacemos un fondo del mismo tamaño que el anterior todo y ponerlo todo transparente menos el agua:

Y éste lo cargamos en un fondo con prioridad inferior al anterior, en mi caso el 3.

3) Y por último, cargamos otro sprite del personaje, y añadimos una distancia en la posición y, sino quedará un reflejo muy raro. Una vez creado usamos la función PA_SetSpritePrio y le ponemos el numero de prioridad del fondo, después lo volteamos con PA_SetSpriteVflip y activamos el efecto de transparencia, obviamente no será nítido de todo, con PA_SetSpriteMode, PA_EnableSpecialFx y PA_SetSFXAlpha.

Para acabar no os olvideis de mover al sprite del reflejo junto con el se va viendo por pantalla y animarlo. Con ésto tendreis un reflejo sobre cualquier superficie que queda bastante bien. En caso de alguna duda o problema postearlo en los comentarios.

He aquí el resultado:
Bye.



I have found a way to make a reflection of the protagonist on a surface of soil. The steps I've done are:
1) Delete (in my case Lihr) all water from background and it make transparent (I use magenta). An example would look like this:

And this picture the charge number in the bottom 2, it could also load in the 0 or 1. I carried on about the first two because I Lihr image with the parties that make the player disappears from the screen as trees and signs.

2) Now do a background the same size as above everything and put everything transparent less water:
And this is a load fund with lower priority to the former, in my case 3.

3) And finally, load other character's sprite, and you add y position distance, but it is rarely a reflection. Once we created the role PA_SetSpritePrio and put the priority number of the background, then turned and PA_SetSpriteVflip to activate the effect of transparency, of course not everything will be clear with PA_SetSpriteMode, PA_EnableSpecialFx and PA_SetSFXAlpha.

You not forget to move the sprite along with the reflection is seeing on screen and cheer. With this may be getting a reflection on anything that is pretty good. In case of any doubt or problem posted in the comments.

Result is:


Bye.

No hay comentarios:

Publicar un comentario