SHARE
TWEET

Untitled

a guest Feb 18th, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /// @desc draw_sprite_shake(sprite, subimg, x, y, xscale, yscale, rot, col, alpha, hardness, motionblur)
  2. /// @function draw_sprite_shake
  3. /// @args sprite,subimg,x,y,xscale,yscale,rot,col,alpha,hardness,motionblur
  4.  
  5. var spr = argument[0]
  6. var subimg = argument[1]
  7. var xx = argument[2]
  8. var yy = argument[3]
  9. var xscale = argument[4]
  10. var yscale = argument[5]
  11. var rot = argument[6]
  12. var col = argument[7]
  13. var alpha = argument[8]
  14. var hardness = argument[9]
  15. var motionblur = argument[10]
  16.  
  17. if motionblur
  18. var usize = shader_get_uniform(shBlur,"size");
  19. var plusx = irandom_range(-hardness,hardness)
  20. var plusy = irandom_range(-hardness,hardness)
  21.  
  22. //if !variable_instance_exists(id,"scr_surface") scr_surface=noone
  23.  
  24. while true
  25. {
  26.     if surface_exists(scr_surface)
  27.     {
  28.         surface_resize(scr_surface,room_width,room_height)
  29.         surface_set_target(scr_surface)
  30.             draw_sprite_ext(spr,subimg,xx+plusx,yy+plusy,xscale,yscale,rot,col,alpha)
  31.         surface_reset_target()
  32.    
  33.         if motionblur
  34.         {
  35.             shader_set(shBlur)
  36.             shader_set_uniform_f(usize,sprite_get_width(spr),sprite_get_height(spr),hardness/1.5)
  37.         }
  38.             draw_surface(scr_surface,0,0)
  39.         shader_reset()
  40.         break;
  41.     }
  42.     else
  43.     {
  44.         scr_surface = surface_create(room_width,room_height)
  45.         if !variable_global_exists("sprshakesurfaces")
  46.             global.sprshakesurfaces = 0
  47.         if !ds_exists(global.sprshakesurfaces, ds_type_list)
  48.             global.sprshakesurfaces = ds_list_create()
  49.         ds_list_add(global.sprshakesurfaces, scr_surface)
  50.     }
  51. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top