View Single Post
Old 09-20-2011   #3
Rogerdodger91
Member
 
Join Date: Jan 2011
Posts: 78
Likes: 0
Liked 23 Times in 14 Posts
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Hmm well in psuedo code i would do the fade away thing like this.

Struct Blood
{
vector4 bloodColorTrans = 0.0f,0.0f,0.0f,0.0f
Int DespawnCounter = 5

//And any other information you might need ect, like coordinates, size, ect //and a sturct constructor.
}

Blood bloodSprite = new Blood("path/to/sprite") //plus other consturct args

List<Blood> bloodList = new list<Blood>()

GameTime counter = GameTime.getSecond()

If(Bullet.Collision)
bloodList.Add(bloodSprite)

Foreach(blood in bloodList)
{
Draw(blood)
}

If (counter % 2.0f == 0) //
{
If (!bloodList == null)
Foreach(blood in bloodList)
{
If(blood.Counter > 0)
{
blood.BloodColorTrans = BloodColorTrans - vector4(0f,0f,0f,.2f);
blood.DespawnCounter - 1;
}
Else
blood.delete();
}
}

This is just a roughdraft of how i would start. (in C# hehe. )
************* [ - Post Merged - ] *************
Perhaps people should add on to what i put?
Rogerdodger91 is offline   Reply With Quote