Author Topic: fire explosion effect  (Read 3162 times)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: fire explosion effect
« Reply #15 on: February 07, 2012, 10:54:46 am »
setTexture()?

Offline gamerfan

  • int
  • **
  • Posts: 97
    • View Profile
Re: fire explosion effect
« Reply #16 on: February 07, 2012, 12:21:21 pm »
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:

Code: [Select]
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:

Code: [Select]
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.

« Last Edit: February 07, 2012, 12:25:26 pm by gamerfan »

Offline Marlon

  • int
  • **
  • Posts: 74
    • View Profile
    • Forgotten Elements Action MMORPG
Re: fire explosion effect
« Reply #17 on: February 08, 2012, 02:40:24 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

Offline gamerfan

  • int
  • **
  • Posts: 97
    • View Profile
Re: fire explosion effect
« Reply #18 on: February 13, 2012, 11:06:28 am »
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