Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// @desc draw_sprite_shake(sprite, subimg, x, y, xscale, yscale, rot, col, alpha, hardness, motionblur)
- /// @function draw_sprite_shake
- /// @args sprite,subimg,x,y,xscale,yscale,rot,col,alpha,hardness,motionblur
- var spr = argument[0]
- var subimg = argument[1]
- var xx = argument[2]
- var yy = argument[3]
- var xscale = argument[4]
- var yscale = argument[5]
- var rot = argument[6]
- var col = argument[7]
- var alpha = argument[8]
- var hardness = argument[9]
- var motionblur = argument[10]
- if motionblur
- var usize = shader_get_uniform(shBlur,"size");
- var plusx = irandom_range(-hardness,hardness)
- var plusy = irandom_range(-hardness,hardness)
- //if !variable_instance_exists(id,"scr_surface") scr_surface=noone
- while true
- {
- if surface_exists(scr_surface)
- {
- surface_resize(scr_surface,room_width,room_height)
- surface_set_target(scr_surface)
- draw_sprite_ext(spr,subimg,xx+plusx,yy+plusy,xscale,yscale,rot,col,alpha)
- surface_reset_target()
- if motionblur
- {
- shader_set(shBlur)
- shader_set_uniform_f(usize,sprite_get_width(spr),sprite_get_height(spr),hardness/1.5)
- }
- draw_surface(scr_surface,0,0)
- shader_reset()
- break;
- }
- else
- {
- scr_surface = surface_create(room_width,room_height)
- if !variable_global_exists("sprshakesurfaces")
- global.sprshakesurfaces = 0
- if !ds_exists(global.sprshakesurfaces, ds_type_list)
- global.sprshakesurfaces = ds_list_create()
- ds_list_add(global.sprshakesurfaces, scr_surface)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement