You need to take a few things into consideration:
1. add another 2 image points at the right and left edges of your sprite - for all the frames and animations (we used bbox bottom in our case for Y, but you can use an image point), this is done so when you mirror the image the shadow will mirror too.
2. spotlight.Y represent the position of the light source, you can alternatively add a var to your sprite with this value, if you want to create a sun lightsource for example you'll need to push it to really high to around -20000 on the Y axis, so it's probably better using a var.
3. Sprite.X and Sprite.Y represent where the light source is falling, should be the lowest ground point on the same X point as the spotlight.
The rest is general, you don't need to change any of it.