I'll start off by saying that I have searched if someone had already asked the same question, but it doesn't seem so. the question i want to ask y'all is the same as the one in the "title", so, how can I, (a newbie) create water/mirror reflection in gamemaker studio 1.4 (pro)? thanks in advance and sorry for my bad english. I am looking forward to learn more, both by your answers and from my personal experiences, too!
Water reflection in gamemaker 1.4?
557 views Asked by Envy At
2
There are 2 answers
1
On
example in empty project
1 create a sprite example:
spr_player
2 create two objects
example:
obj_player // assign them the sprite that you created
obj_reflection
3 on the obj_player
event step
/// @description maker event step
// character movement
friction = 0.1;
if (keyboard_check (vk_right))
{
direction = 0;
speed = 4;
}
if (keyboard_check (vk_left))
{
direction = 180;
speed = 4;
}
if (keyboard_check (vk_up))
{
direction = 90;
speed = 4;
}
if (keyboard_check (vk_down))
{
direction = 270;
speed = 4;
}
4 on the obj_reflection
event draw
/// @description maker draw event
// redraw the object (the same sprite, same position x, same position and more the size of the object, same width, we invert the scale in half, same angle, same color mix, transparency in half)
draw_sprite_ext (spr_player,0,obj_player.x,obj_player.y + 100,image_xscale,-0.5,image_angle,image_blend, 0.5);
5 we put both objects in the room and voila we have a reflection
6 experiment changing the values to see the results
7 for the water effect we place the objects in different layers placing the reflection object underneath and the texture of water in the middle layer
8 by the way I speak Spanish, if so, enter your question at https://es.stackoverflow.com/
if you liked the answer give me a plus 1, thank you very much. BusyClown +51912423012
There's three ways you could achieve a reflection effect, but I'm afraid none are really "beginner" level.
The easiest one would be to draw an inverted sprite of the reflected object. This might work for a few objects, but it's not very accurate and doesn't allow for more advanced effects.
The second one would be to use surfaces. Create a surface, capture the reflected area, draw in reverse. With that, you can use a bit more effects.
The third way would be shaders, but it seems even less beginner friendly imo.
If the first solution doesn't help, I would suggest finding a workaround until you have the appropriate experience or learn using surfaces.