Erase a part of a sprite like in worms game


I would like to modify a sprite in game. With left click it would erase a part of the sprite like a rubber with an adjustable size and shape (square or circle). With right click it would draw on the sprite with different size.

The idea is to be able to create game like worms where you can destroy background or with a special gun ( right click) modify background.

I hope you could help thanks

What you’re talking about is either:

  1. A sprite mask (which I don’t think is currently available in the platform)
  2. Custom animations for your object that it switches between

You can just add shapes on the background I think

First i would like to create a sort of worms-like. The player shoot a bullet on the ground and it creates a hole in the ground. Just like in the game worms.

I saw that 4ian made an exemple called destruction.gdg but it only works on gdevelop 4 but i can t find the link anymore.

I see what you mean. If you draw some “hole sprites”, i mean some blue circles on the mountain background, you will get the feeling of a hole. Also, you could add trasparency mask using a new experimental extension, and you will get probably a better effect.
But you need changing collision too. For example ignoring it when you are on a " hole sprite".
I think it’s possible

1 Like

The game destruction.gdg canno’t work on GD5, GD5 missing two action for masking, and copy an image on another one.
I’ve started the work for porting this two actions from 4 to 5, but it’s in pause for now, i’ve others priority.

1 Like

“copy an image on another one”
What did this action do in gdevelop 4? It modified an image without creating a new sprite?

1 Like

Thanks for the precisions and your time.

I hope you will find some time to port it on gd5 but i understand that you other priority. :slight_smile:

The action take a object, the positions X and Y, and an image file.
This images will be merge in your sprite object at the positions X,Y.

This actions is used with another one, remove a color from an object, and when you merge a sprite, let said purple, on your object, and used the action for remove the color purple you have made a hole in your sprite object. This what happend in GD4 destruction terrain.gdg


So for example you could paint 1000 colored circles on a background without generating 1000 sprites?

Thanks Bouh and Tarsio, i will try in gd4 then if needed i will update my game to gd5 when the feature will be available. :wink: