I had a thread for this earlier but I phrased my question in an odd way and never got very good help.
I'm attempting to create an effect in my shoot em up game where when an enemy ship is destroyed (or player), a surface is programmed to create a motion blur moving away from where the explosion is. The best example of this being used elsewhere is the game Ad Nauseam 2 .
This is the code I'm playing with:
Object named Surfaces_OBJ
CREATE EVENT - blurstart is the variable that goes off when there's a collision between a bullet and an enemy ship, this would be changed to when the enemy ship explodes
--------------
blursurface=surface_create(room_width,room_height);
surface_set_target(blursurface);
draw_clear_alpha(c_white,0);
surface_reset_target();
blurstart=0
STEP EVENT - Testing if the enemy ship has been hit
--------------
if (instance_position(Explosion_Test_OBJ.x,Explosion_Test_OBJ.y,Bullet_OBJ))
{
blurstart=5
}
END STEP - I've just been playing with code to try out a motion blur. Nothing successful so far. The // parts are other things that I've tried. You can toggle them appropriately.
--------------
surface_set_target(blursurface);
//draw_set_alpha(.3)
//draw_set_color(c_white)
//draw_rectangle(0,0,room_width,room_height,false)
//draw_set_color(c_black)
//draw_rectangle(0,0,room_width,room_height,false)
draw_surface_ext(blursurface,0,0,1,1,0,c_white,.9);
if (blurstart>=1)
{
//draw_surface_ext(blursurface,0,0,1,1,0,c_white,.9);
with (Ship_OBJ)
{
draw_sprite_ext(sprite_index,image_index,x,y,1.2,1.2,.1,c_white,.9);
}
blurstart-=1;
}
surface_reset_target();
ROOM END - Freeing the surface
--------------
surface_free(blursurface);
DRAW - Drawing the surface
--------------
draw_surface(blursurface,0,0);
If you've made it this far I really appreciate it. Could someone assist me in finding other surfaces techniques to achieve this effect?
Thanks
Surfaces Blurring
Started by TimTro, May 31 2012 06:51 AM
4 replies to this topic
#1
Posted 31 May 2012 - 06:51 AM
#2
Posted 03 June 2012 - 08:23 PM
Guys, I still really need help with this and I haven't been able to make much progress with the resources available. Sorry I'm double posting but it's been a while.
#3
Posted 03 June 2012 - 08:39 PM
Yeah, sorry, just drawing with alpha won't give a blur effect, I don't think.
I've never done this myself, but what I suspected (and googling around) concludes, that the best method is to draw to the surface, then scale down, then scale back up, making sure texture_set_interpolation() is true.
Probably something best done 'before hand' in the sprite editor, tbh. :/
I've never done this myself, but what I suspected (and googling around) concludes, that the best method is to draw to the surface, then scale down, then scale back up, making sure texture_set_interpolation() is true.
Probably something best done 'before hand' in the sprite editor, tbh. :/
#4
Posted 03 June 2012 - 10:13 PM
...
Edited by zehevi, 01 July 2012 - 05:27 PM.
#5
Posted 04 June 2012 - 10:38 PM
Thanks for the responses!
I've been having a problem with my copy of studio as of recent, but as soon as I get that back up I'll try those out.
I've been having a problem with my copy of studio as of recent, but as soon as I get that back up I'll try those out.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











