2D Destructible Objects
This GDScript plugin for Godot 3 allows you to easily create destructible 2D objects. It divides a sprite into blocks that explode upon impact, adding dynamic destruction to your game.
https://github.com/hiulit/Godot-3-2D-Destructible-ObjectsPreview Images



2D Destructible Objects in Godot 3
This plugin provides a simple way to implement destructible objects in your Godot 3 2D games. It works by taking a sprite, dividing it into smaller blocks, and applying an explosive force to those blocks when the object is 'destroyed'. This creates a visually appealing destruction effect, enhancing the gameplay experience.
Key Features
- Sprite Division: The script divides a sprite into a grid of blocks, allowing for controlled fragmentation.
- Explosion Effect: When triggered, the blocks are propelled outwards, simulating an explosion.
- Customizable Parameters: Adjust parameters like block count, impulse strength, gravity, and debris lifespan to fine-tune the destruction effect.
- Collision Management: Control collision layers and masks for the individual blocks.
- Debris Handling: Choose to either let the debris remain on screen or automatically remove it after a set time.
Usage
To use the plugin, you need to structure your destructible object scene correctly, with a RigidBody2D
as the root, containing a Sprite
and a CollisionShape2D
. The provided explode_object.gd
script is then attached to the RigidBody2D
node. The script offers several parameters for customization, such as the number of blocks per side (blocks_per_side
), the force of the explosion (blocks_impulse
), and the gravity scale of the blocks (blocks_gravity_scale
). You can also control the collision layers and masks of the blocks, and whether or not the debris should be removed after a certain time.