Open petomavar opened 7 years ago
There are methods for emitters based on X-Y coordinates, but not for oneShot, although it should not be hard to add them.
However, building a game using Views you are going to encounter performance problems quite soon. If you are doing it for the learning experience, I recommend you to take a look at Mastering Android Game Development which has a chapter about particle systems based on this library. It also has a chapter about efficient collision detection.
Otherwise, to build a breakout style game, which is 2D, I'd recommend using an engine, like AndEngine, which also has its own particle system implementation.
OK, I will check and try with emiter, I also found that book.
There is one quick hack you can do, which is to have a 1 x 1 dip view with no background and use that one as the anchor for the particle system.
You need to reposition that view to the x, y and then do the oneShot, it will read the position of the anchor view.
As I said it is a hack / woraround, but it should do the trick.
Great codes. I have a brick breaker game and want particle on place where ball hits the brick. From Main class:
And now behind that I put ParticleSystem code inside:
because my View is defined in Screen class and Main class extends Screen class. From Screen.java:
And as a result I always got particles in middle of layout insted of place where destroyed brick is. How to attach code to bricks_current_level[x][y] position?