fire explosion effect

Started by gamerfan, November 26, 2011, 04:33:03 PM

Previous topic - Next topic

EgonOlsen


gamerfan

#16
I was able to do some mock up kind of thing: this is what I have done.I took a muzzle flash texture from net.

In the Car example, I loaded a plane and added this texture to it.Then in the processProjectile() method, just used like a on-off kind of switch.This will however produce gun firing effect.But not perfect.Also, have not tried it with my actual code.

Loading muzzle flash:


private void loadMuzzleFlashObject(){
   muzzle = Primitives.getPlane(1,4);
   muzzle.translate(new SimpleVector(0, 10, 0));
   muzzle.scale(10);
   Texture muzzleTexture = new Texture("textures" + File.separatorChar + "MuzzleFlash.jpg");
   texMan.addTexture("muzzleflash", muzzleTexture);
   muzzle.setTexture("muzzleflash");
   muzzle.build();
   theWorld.addObject(muzzle);
   muzzle.setVisibility(false);
}

Displaying muzzle flash:


private void displayMuzzleFlash(){
   if(muzzle.getVisibility())
      muzzle.setVisibility(false);
     else
      muzzle.setVisibility(true);   
}

This method is called from the processProjectile() method.Now the issues I am facing are :
1. The image is a .jpg so it will not have transparancy.This is can be rectified.
2. The color of the actual .jpg is yellow.But when I added along with the car example, the color of the texture is changed to violet, ie it is taking the color of the Car.I am not able to figure out why this is happening.I have not manually instructed to change the color to violet.


Marlon

Quote from: gamerfan on February 07, 2012, 12:21:21 PM
2. The color of the actual .jpg is yellow.But when I added along with the car example, the color of the texture is changed to violet, ie it is taking the color of the Car.I am not able to figure out why this is happening.I have not manually instructed to change the color to violet.

Cool, I just made an explosive effect for my game yesterday. :)
To anwer your second question. Search your code for "setAdditionalColor()". I suppose, that you are filling your particle with an extra color.
www.forgottenelements.com
Free Action JAVA MMORPG

gamerfan

Quote
Cool, I just made an explosive effect for my game yesterday. :)
To anwer your second question. Search your code for "setAdditionalColor()". I suppose, that you are filling your particle with an extra color.
Sorry I am not using any additionalColor() here. What I am doing is attaching muzzle flash jpg to plane object.That is it.In fact my current code is not all using any particle system nor above method.
Also curious to know how did you do that.  :D