glitchdetector icon

[GML] draw_shadow_all

glitchdetector | PRO | 09/06/14 04:43:04 PM UTC | 0 ⭐ | 576 👁️ | Never ⏰ | []
Game Maker |

0 B

|

None

|

0 👍

/

0 👎

///draw_shadow_all(length,direction,color,alpha)
// Written by GlitchDetector
// Made for top-down intentions
 
// - This script only needs to be run once every draw event, not in multiple instances
// - Will draw shadows for all instances (that has a sprite and is visible)
// - Put this in an instance that is below all others and above the background
 
var shadowlen,shadowdir,shadowcol,shadowalpha;
 
shadowlen   = argument0 // Distance from instance to shadow
shadowdir   = argument1 // Direction the shadow is cast
shadowcol   = argument2 // Shadow color
shadowalpha = argument3 // Shadow alpha
 
with(all){
  if sprite_index != -1 && visible {
    var xoff,yoff;
    xoff = lengthdir_x(shadowlen,shadowdir)
    yoff = lengthdir_y(shadowlen,shadowdir)
    draw_sprite_ext(sprite_index,image_index,x + xoff,y + yoff,image_xscale,image_yscale,image_angle,shadowcol,shadowalpha)
  }
}

Comments