[Solved]How can i add drops to bricks

i was wondering about how to add random drops to the bricks ,
i don’t know the proper way to make such things but i tried this way

_for Example :my brick takes 3 hits to get destroyed and 2 sprites( damage effects ) so i tried to make it 3 sprites and the last sprite element is not even a brick its the drop sprite ,Also i added a (Rigidbody2D) static type to the bricks and in the script i wrote a code to change the type of the (Rigidbody2D) to dynamic in the moment of brick destroyed to make the drop sprite gets some gravity and get down to the paddle.

_I know that this way i tried to create this drops is unprofessional so i need a help to get directed to the right way

Hi,

I did this !

I create a new prefab with Sprite, Collider and Rigibody and turn it has a trigger.
I’ve added his script to handle some properties and adding different sprites to manage multiple bonus.
In this script I add an OnTriggerEnter2D to verify some conditions and to handle my bonuses.

In Brick script I’ve added a random condition in Start to random adding the bonus in breackable blocks.
In HandleHits method I’ve added a verification to know if the brick should drop a bonus and then the Instantiate magic do the trick :smiley:

Hope this could help :slight_smile:

all is in the Instantiate ^^

1 Like

Thank you mate
your reply helped me alot .

Privacy & Terms