Hi!
I noticed that my mushroomcloud explosion wasn’t really mushy ingame…
I also noticed its upside down for some reason…
It’s probebly because I set the particle material differently.
But anyways, heres my code:
[java]explosion = new ParticleEmitter(“My explosion effect”, ParticleMesh.Type.Triangle, 1);
explosion.setEndSize(15);
explosion.setStartSize(3);
explosion.setStartColor(ColorRGBA.Red);
explosion.setEndColor(ColorRGBA.Red);
explosion.setHighLife(1);
explosion.setMaterial(MaterialManager.Texture(“Explosion_1.png”));
explosion.setImagesX(16); // columns
explosion.setImagesY(1); // rows
explosion.setSelectRandomImage(false);[/java]
And heres how I get the MaterialManager.Texture:
[java]public static Material getNormal(String name){
Material mat = new Material(MainGame.app.getAsset(),“Common/MatDefs/Misc/Unshaded.j3md”);
mat.setTransparent(true);
mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
mat.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off);
Texture img = ImageLoader.Load(name);
img.setWrap(WrapMode.Repeat);
img.setMagFilter(Texture.MagFilter.Nearest);
img.setMinFilter(Texture.MinFilter.NearestNearestMipMap);
mat.setTexture(“ColorMap”, img);
return mat;
}[/java]
Do you know why I’m getting half the image AND that half upside down?
Way easier to play around with the settings when using the SDK to create the emitter… Anyway, you sure its 16 pictures horizontally?
Err, just looking again, you don’t use the particle emitter material…
Yea, I tried to explain that…
Thought you could use any material, but you cant?
At least you cannot expect all functions to work just like this with another material.
Humm… I tried this now:
[java]explosion = new ParticleEmitter("My explosion effect", ParticleMesh.Type.Triangle, 1);
explosion.setEndSize(15);
explosion.setStartSize(3);
explosion.setStartColor(ColorRGBA.Red);
explosion.setEndColor(ColorRGBA.Red);
explosion.setHighLife(1);
Material mat_flash = new Material(MainGame.app.getAsset(), "Common/MatDefs/Misc/Particle.j3md");
Texture img = ImageLoader.Load("Explosion_1.png");
img.setMagFilter(Texture.MagFilter.Nearest);
img.setMinFilter(Texture.MinFilter.NearestNearestMipMap);
mat_flash.setTexture("Texture", img);
explosion.setMaterial(mat_flash); //MaterialManager.Texture("Explosion_1.png"));
explosion.setImagesX(16); // columns
explosion.setImagesY(1); // rows
explosion.setSelectRandomImage(false);[/java]
Problem is, the particle is transparent tho the image is not (except outside the explosion).
Can I set it to only transparent the fully transparent pixels?
I found no such method tho…
Particle.j3md sets the blend mode to AlphaAdditive. You could change it but then I predict a future post: “Why are my particles in the back clipping my particles in the front?”
To save time, the particles aren’t z-sorted so they don’t work well with traditional alpha. You have to use a blend mode that works no matter what order the particles are drawn in.