- Home /
bomb effect
I would like to ask something about bomberman-like game. I've got a problem about the bomb that the player produces. I can destroy it after a few seconds but I have no idea on how to put the fire effect and destroy the bricks around the fire.. thank you so much for the help. I think there are other questions about this matter, but nothing helped me because I'm just a beginner and I cannot understand some of their codes. thank you so much..
Answer by Aggerwal · Jun 26, 2016 at 09:12 PM
Before destroying the bomb, the bomb code could spawn four fire objects around the bomb and those could have code keeps spawning more fire in the direction they are facing or just stop when they hit a wall. You could do these types of checks by using something called raycast. Then to destroy bricks, the brick object code should check whether the fire objects has collided with them and destroy themselves. Either one of the fire or brick objects should have a rigidbody component and the other one a mesh collider for the collision to be picked up.
Answer by Landerk · Jun 28, 2016 at 04:51 AM
So I think Unity has a premade Particle system for fire and explosion...I could be wrong there, but it wouldn't be too hard to make anyway. For fire and explosions I will always recommend using a particle system. You'll have to call it to play on destruction of the bomb object. As for breaking down the "burning" object, have 2 or 3 extra game objects...for example, your regular undamaged brick, slightly burnt brick, roasted brick, pile of ashes. That might be a bit much but you get the idea. Then just switch those meshes out over the lifetime of your particle animation and you'll get a believable burning effect.