Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/28/24 09:55
basik85278
by basik85278. 04/28/24 08:56
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 744 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 5
Page 1 of 2 1 2
flame particle effect #220514
08/07/08 13:41
08/07/08 13:41
Joined: Jul 2008
Posts: 24
Russia
mr_x Offline OP
Newbie
mr_x  Offline OP
Newbie

Joined: Jul 2008
Posts: 24
Russia
The goal of this example is that particle has start and end colors. And particle interpolate between this colors during life cycle.

DOWNLOAD
Code:
///////////////////////////////////////////////////////////////////
BMAP* flame_particle = "flame.tga"; // set here your particle image
///////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////
var start_color[3];		// start color of the particle
var end_color[3];			// end color of the particle
var current_color[3];	// current color of the particle
var flame_lifespan = 10;
///////////////////////////////////////////////////////////////////

// helper function: sets the vector to random direction and length
function flame_randomize (var* vec, var range)
{	
   vec[0] = random(1) - 0.5;
   vec[1] = random(1) - 0.5;
   vec[2] = random(3) + 0.5;
   vec_normalize(vec,random(range));
}

// helper function: fades out a particle
function flame_alphafade(PARTICLE *p)
{
	start_color[0] = 200;
	start_color[1] = 180;
	start_color[2] = 100;
	
	end_color[0] = 128;
	end_color[1] = 50;
	end_color[2] = 50;
	
	vec_lerp(current_color[0], end_color[0], start_color[0], p.lifespan / flame_lifespan);

	p.red = current_color[0];
	p.green = current_color[1];
	p.blue = current_color[2];
	
	p.alpha = p.lifespan / flame_lifespan * 100 * 0.3;
	if (p.alpha <= 0) p.lifespan = 0;
}

// particle function: generates a fading explosion into vel direction
function effect_flame(PARTICLE *p)
{
   var temp[3];
   flame_randomize(temp, 5);
   vec_add (p.vel_x, temp);
   p.bmap = flame_particle;
   p.flags |= (BRIGHT | MOVE | TRANSLUCENT);
   p.lifespan = flame_lifespan;
   p.size = 12;
   p.event = flame_alphafade; // change to a shorter, faster function
}


Last edited by mr_x; 08/07/08 14:22.
Re: flame particle effect [Re: mr_x] #220517
08/07/08 13:44
08/07/08 13:44
Joined: Nov 2007
Posts: 1,032
Croatia
croman Offline
Serious User
croman  Offline
Serious User

Joined: Nov 2007
Posts: 1,032
Croatia
Error
The uploader has removed this file from the server.

the file is deleted, upload again



Ubi bene, ibi Patria.
Re: flame particle effect [Re: croman] #220571
08/07/08 14:08
08/07/08 14:08
Joined: Jul 2008
Posts: 24
Russia
mr_x Offline OP
Newbie
mr_x  Offline OP
Newbie

Joined: Jul 2008
Posts: 24
Russia

Re: flame particle effect [Re: mr_x] #224286
08/29/08 13:29
08/29/08 13:29
Joined: May 2008
Posts: 91
Eugene, OR. USA
ATOMIX Offline
Junior Member
ATOMIX  Offline
Junior Member

Joined: May 2008
Posts: 91
Eugene, OR. USA
That's just a come on to buy a download service!!!
Where's the file?
Thanx a lot!


ATOMIX Productions
ATOMIX Group LLC
http://theatomizer.com
A7 Pro 7.50
Re: flame particle effect [Re: ATOMIX] #224485
08/30/08 13:43
08/30/08 13:43
Joined: Jul 2008
Posts: 24
Russia
mr_x Offline OP
Newbie
mr_x  Offline OP
Newbie

Joined: Jul 2008
Posts: 24
Russia

Re: flame particle effect [Re: mr_x] #224487
08/30/08 13:58
08/30/08 13:58
Joined: May 2008
Posts: 91
Eugene, OR. USA
ATOMIX Offline
Junior Member
ATOMIX  Offline
Junior Member

Joined: May 2008
Posts: 91
Eugene, OR. USA
Alright that did it!! Thanx a lot


ATOMIX Productions
ATOMIX Group LLC
http://theatomizer.com
A7 Pro 7.50
Re: flame particle effect [Re: ATOMIX] #224493
08/30/08 14:20
08/30/08 14:20
Joined: Jul 2008
Posts: 24
Russia
mr_x Offline OP
Newbie
mr_x  Offline OP
Newbie

Joined: Jul 2008
Posts: 24
Russia
I hope it will be useful smile

Re: flame particle effect [Re: mr_x] #225404
09/04/08 12:29
09/04/08 12:29
Joined: Apr 2008
Posts: 139
Japan, Osaka
Tails01 Offline
Member
Tails01  Offline
Member

Joined: Apr 2008
Posts: 139
Japan, Osaka
yeah simple and nice, thanks mr_x

Tails


An implemented second-rate idea is better than a good idea, which gathering dust in your brain.
Re: flame particle effect [Re: mr_x] #225644
09/05/08 14:38
09/05/08 14:38
Joined: May 2008
Posts: 91
Eugene, OR. USA
ATOMIX Offline
Junior Member
ATOMIX  Offline
Junior Member

Joined: May 2008
Posts: 91
Eugene, OR. USA
It's gorgeous and you made our Artist very happy.


ATOMIX Productions
ATOMIX Group LLC
http://theatomizer.com
A7 Pro 7.50
Re: flame particle effect [Re: ATOMIX] #226010
09/07/08 09:44
09/07/08 09:44
Joined: Oct 2003
Posts: 827
22�21'24"N 114�07'30"E
Frederick_Lim Offline
User
Frederick_Lim  Offline
User

Joined: Oct 2003
Posts: 827
22�21'24"N 114�07'30"E
Very nice effect~!

Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1