Adding drop shadow to object without causing lag

What would be the best way to add drop shadow to object without drawing in the drop shadow to each sprite or using the drop shadow effect, the drop shadow effect would not be an option for me due to how many objects each world in my game will have meaning it causes massive lag. Drawing in the drop shadow to each sprite messes with the grid for my block placing system. So i have no clue what else i could do to achive a drop shadow effect for all the object on the scene i choose to have a drop shadow.

Drop shadows like on this image :


Each block and player has a drop shadow

Hi, I don’t know how the game in the screenshot was made but it looks a little bit as if the shadow was already part of the sprite-object. So instead of adding light or an additional sprite just draw the shadow to the actual sprite-object.
Since the shadows in the screenshot have reduced opacity you need a software that allows you to draw and save sprites with different opacities. As far as I know Piskel does not have this functionality but you could use Krita or libresprite for that.

As i mentioned, if i would to do it this way, it would mess with my grid while placing blocks, and i’ve already tried doing it and it was just very off with the layering, the shadows were just above some of the other objects which was just a big mess in the end

You’ve pretty much mentioned to two main ways of generating a drop shadow…


Will it? Have you tried it? Add the drop shadow effect on a layer, not the objects (and place the objects in that layer). I would expect the drop shadow to only impact the objects on screen, not those off screen.

Is it really not working with your grid? I understand that it is not optimal but it should be still possible to place your tiles.

Of course you need a tileset that has tiles with and without shadows (like the blocks in the upper part of your screenshot).

As this could be quite tedious I would definitely try what MrMen suggested.

actually i never tried to use the drop shadow on a layer, thanks for the idea, i’ve only applied it to the actual object making is cause massive fps drop

drawing in the shadow to each sprite is something i don’t really wanna do because i wanna stick to 32x32 sprites, and it’ll just give me hard times with the block placing. and creating the shadow as a seperate object would just not be ideal due to how much it would impact the fps

You can put a good number of sprites on the screen without any drop in FPS. A shadow would have no processor heavy behaviours or effects, so there’s minimal processing involved in presenting it.

Another option, if your sprites don’t rotate, is the sticker extension. Once installed, you’d add the extension as a behaviour on the shadow objects, and with one action stick it to the game sprite. No further need to worry about positioning the shadow - the sticker behaviour does it all for you, with minimal overhead.

Add all the sprite objects that you want to have a shadow to a group called Shadowed. Also create group called Shadow and put the same objects in there.
On init: For each Shadowed object:
create an object from Shadow group by name: Shadowed.getObjectName().
Set that Shadow object Z order to be Shadow.zOrder() -1
Set the tint of the Shadow object to 0;0;0
Set the opacity of the Shadow object to 200
Subtract 10 from the Y position of the new object
Subtract 10 from the X position of the new object
link the Shadow object to the Shadowed object

Each Frame:
For each Shadow object:
Get the link to the Shadowed object
Move the position of Shadow object to the Shadowed object position: X - 10, Y - 10