@SetasSan said:
I have one more question is it possible add separated images in ElementEmitter ?
with set Sprite I can add only one image.
And how i can set up collisionListener ?
should i access all quads emitter.getParticles().getQuads() and check a bullet position and enemy position ?
The one image can contain multiple sprites. I need to go look and see how you define the sprite images (as it’s a bit different from the actual particle emitter I put together)… one sec.
Ok, for basic animated sprites, you just call:
[java]
// Path to sprite image, number of sprite rows, number of sprites in each row, the target FPS for frame changes
ElementEmitter.setSprite(String spriteImagePath, int spriteRows, int spriteCols, int targetFPS);
[/java]
This will cycle through the images at the defined frames per second.
For more advanced sprite usage, use the SpriteInfluencer…
This allows for all sorts of different methods of animation:
SequentialAll - Shows all frames in sequential order at the defined FPS (I believe this is the default sprite setting for the emitter not using this influencer)
SequentialAllOverLife - Shows all frames in sequential order once over the life of the particle
SequentialDefinedOrder - Uses the defined frame order (2,7,3,10,12,12,7,etc) showing showing the frame sequence at the target FPS
SequentialDefinedOrderOverLife - Uses the defined frame order (2,7,3,10,12,12,7,etc) showing each defined frame once over the life of the particle
RandomAll - This shows all frames in random order at the target FPS
RandomAllOverLife - This shows all frames once over the life of the particle
RandomDefinedOrder - This allows you to define the sprite frames to use but shows them in random order at the defined target FPS.
RandomDefinedOrderOverLife - This allows you to define the sprite frames to use but shows them in random order once over the lifecycle of the particle.
SingleImage - Uses a single image from the frames (I believe you define which it uses)
EDIT: The 2D emitter doesn’t have physics collision like the regular emitter, however if you look at… um… one sec… HitCalculator.java in the Galaga game, you’ll see how I am doing this. All bullets are particles from an emitter