Advertisement
glitchdetector

[GML] draw_shadow_all

Sep 6th, 2014
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ///draw_shadow_all(length,direction,color,alpha)
  2. // Written by GlitchDetector
  3. // Made for top-down intentions
  4.  
  5. // - This script only needs to be run once every draw event, not in multiple instances
  6. // - Will draw shadows for all instances (that has a sprite and is visible)
  7. // - Put this in an instance that is below all others and above the background
  8.  
  9. var shadowlen,shadowdir,shadowcol,shadowalpha;
  10.  
  11. shadowlen   = argument0 // Distance from instance to shadow
  12. shadowdir   = argument1 // Direction the shadow is cast
  13. shadowcol   = argument2 // Shadow color
  14. shadowalpha = argument3 // Shadow alpha
  15.  
  16. with(all){
  17.   if sprite_index != -1 && visible {
  18.     var xoff,yoff;
  19.     xoff = lengthdir_x(shadowlen,shadowdir)
  20.     yoff = lengthdir_y(shadowlen,shadowdir)
  21.     draw_sprite_ext(sprite_index,image_index,x + xoff,y + yoff,image_xscale,image_yscale,image_angle,shadowcol,shadowalpha)
  22.   }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement