Game Development Community

Particle of blood

by Marcus Araujo · in General Discussion · 01/04/2008 (5:29 am) · 4 replies

Hi Folks,

How can I make particles of blood? It's looks like a fire particle?

I want to make a "smoke of blood" in a RPG game when the objects(players and computers) are in contact with a Spear, Sword, ... Ok, I have the position of the player and I want to spield some blood on the center of the player, at the head for exemple, how can I make this?

I try this follow code, but don't work. . .

datablock ParticleData( FireParticle )
{
textureName = "~/data/shapes/blood/fire";
dragCoefficient = 0.0;
gravityCoefficient = -0.3; //Gravity pulls down, but a negative value makes the particles rise instead of sink
inheritedVelFactor = 0.00;
useInvAlpha = false;
spinRandomMin = -30.0;
spinRandomMax = 30.0;

lifetimeMS = 500;
lifetimeVarianceMS = 250;

times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;

colors[0] = "0.8 0.6 0.0 0.1";
colors[1] = "0.8 0.6 0.0 0.1";
colors[2] = "0.0 0.0 0.0 0.0";

sizes[0] = 1.0;
sizes[1] = 1.0;
sizes[2] = 5.0;
};

datablock ParticleEmitterData( FireParticleEmitter )
{
particles = "FireParticle";

ejectionPeriodMS = 15;
periodVarianceMS = 5;

ejectionVelocity = 0.25;
velocityVariance = 0.10;

thetaMin = 0.0;
thetaMax = 90.0;
};

datablock ParticleEmitterNodeData( FireParticleEmitterNode )
{
timeMultiple = 1;
};


//This Function are called when a Player Hit something, and this function spield some "smoke blood"
function showBlood(%pos)
{
echo("BLOODDDD!!!!!!!!!");
%part = new FireParticle();
%part.position=%pos;
}


Any ideas?!?

TKS!

#1
01/04/2008 (11:33 pm)
Hmm, well for one thing:

textureName = "~/data/shapes/blood/fire";

might have something to do with it.

But more usefully, have you checked out the Particle Editor?
#2
01/07/2008 (4:23 am)
I put on function showBlood this follow code:

function showBlood(%pos)
{
echo("BLOOODDD");

new ParticleEmitterNode(FIRE){
dataBlock = "FireParticleEmitterNode";
emitter = "FireParticleEmitter";
position = %pos;
rotation = "1 0 0 0";
scale = "1 1 1";
};
}

And works Great!

But I hav only one problem, How can I change to the particle disapear in a few secunds? What I have to do in the dataBlock to particle disapear?!?

TKS!
#3
01/07/2008 (5:09 am)
Try and create a schedule which will delete the "FIRE" object.
For example...

function showBlood(%pos)
{
   echo("BLOOODDD");

   new ParticleEmitterNode(FIRE){
      dataBlock = "FireParticleEmitterNode";
      emitter = "FireParticleEmitter";
      position = %pos;
      rotation = "1 0 0 0";
      scale = "1 1 1";
   };

   schedule( 1000, 0 ,"stopBlood" );
}

function stopBlood()
{
    if (isObject(FIRE)) FIRE.delete();
}

This should cause the emitter to disapear after 1second. You can change the 1000 in the schedule to less or more if you want the blood to stay for shorter/longer duration.
#4
02/06/2008 (5:14 am)
Quote: "smoke of blood"
YUCK!