How can I make a particle effect in Java like this: https://www.youtube.com/watch?v=BOVQEfnavx0.
I am making a game when an object hits another object, a point gets earned then the 2nd object will be destroyed and an effect will occur much like in the video.
I have googled a lot but didn’t find any solution. Currently I am using particle effects with libgdx, however I want a particle effect similar to the YouTube video.
There is a tool for use with Libgdx called 2d Particle Editor which is available to download from here.
For a guide on how to use the editor you can look on gamedevelopment.blog or on Libgdx editor guide
This effect is not too complex – you can do it on your own also.
So, you can draw those particles the same way you draw other objects. Make some array for holding those particles (i.e. their coordinates, velocities and maybe animation state or size – what ever you want to animate).
Then, when this effect should happen you just have to create some number of those particle objects and store them into that array. They all should share same starting position (X and Y coords) but different (random) starting velocities. You can have Vx and Vy velocities to make calculations easier.
Then as time passes particles will change their coordinates depending on velocities and go apart. You can also add some gravity – decrease Y velocity at every step.
At end you, when some amount of time passes or animation reaches some frame or something you’ll just destroy all the particle objects and animation is done.
I used that method in my LibGDX game too. You can see how it looks like in action here: https://www.youtube.com/watch?v=40q8zkZgieo