JAG
Member
Hiya! Im working on a local multiplayer deathmatch game. One of my characters can cloak, and so far Ive been using a temporary low-alpha sprite to subtly "reveal" your location so you know where you are. The problem with this is that then your enemies also know where you are.
I had the idea that the light-bending "shimmer" from Predator is the way to go here -- it could be made subtle enough that you only see it if you're looking for it.
I've actually accomplished this effect the following way:
1. Make a copy of the application_surface (surf1)
2. Draw that surface to a second surface (surf2) with a magnification shader effect applied to the area around the character -- at this point I just have a big magnification bump being drawn on the surface.
3. Now the tricky part: Take surf1 and punch a character-shaped hole in it using alpha blending, like so:
Now I can draw surf2 (with the magnification), and then draw surf1 (with the hole) on top, and there's my effect:
http://www.giphy.com/gifs/400DWx6FCZngNt7Fji
The problem is that in order to achieve this effect I had to draw my surfaces in the Draw-GUI event, because if I draw the effect to the application_surface the image stops moving (because its drawing the copy of the application_surface which it previously copied from the previous frame, which was also a copy of the previous etc etc):
http://www.giphy.com/gifs/63LW7x9MNUFXjs9jUh
But it feels very strange to render the whole game from the Draw-GUI event, and that comes with it's own host of issues.
How do I fix this this?! Any ideas, maybe for an alternate implementation?
Thanks!
I had the idea that the light-bending "shimmer" from Predator is the way to go here -- it could be made subtle enough that you only see it if you're looking for it.
I've actually accomplished this effect the following way:
1. Make a copy of the application_surface (surf1)
2. Draw that surface to a second surface (surf2) with a magnification shader effect applied to the area around the character -- at this point I just have a big magnification bump being drawn on the surface.
3. Now the tricky part: Take surf1 and punch a character-shaped hole in it using alpha blending, like so:
Code:
surface_set_target(Surf1)
draw_set_blend_mode_ext(bm_inv_src_alpha, bm_inv_src_alpha)
draw_sprite(Owner.sprite_index, Owner.image_index, Owner.x, Owner.y)
draw_set_blend_mode(bm_normal)
surface_reset_target()
http://www.giphy.com/gifs/400DWx6FCZngNt7Fji
The problem is that in order to achieve this effect I had to draw my surfaces in the Draw-GUI event, because if I draw the effect to the application_surface the image stops moving (because its drawing the copy of the application_surface which it previously copied from the previous frame, which was also a copy of the previous etc etc):
http://www.giphy.com/gifs/63LW7x9MNUFXjs9jUh
But it feels very strange to render the whole game from the Draw-GUI event, and that comes with it's own host of issues.
How do I fix this this?! Any ideas, maybe for an alternate implementation?
Thanks!