You have to turn on stencil shadow, write this
line of code in the top of your script :

var shadow_stencil = on;

BTW, I think this post should move to "Starting with GameStudio".