Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, The_Judge, Grant), 898 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Problem with fading particle #291137
09/23/09 14:58
09/23/09 14:58
Joined: Nov 2003
Posts: 433
The Netherlands
T
Toon Offline OP
Senior Member
Toon  Offline OP
Senior Member
T

Joined: Nov 2003
Posts: 433
The Netherlands
I have a problem fading particles for a while now. The function below used to work some time earlier.

Code:
function fade_particle()
{
     my.alpha -= 10 * time;
     my.size -= 1;
     if (my.alpha < 0 || my.size < 0) {my.lifespan = 0;}
}

function particle_water()
{
	temp.x = random(2) - 1;
   temp.y = random(2) - 1;
   temp.z = random(2)-random(2);
	vec_add (my.vel_x, temp);
	my.alpha = 20;
	my.bmap = water_map;
	my.size = random(5)+5;
	my.flare = on;	
	my.bright = on;
	my.move = on;
	my.translucent = on;
	my.lifespan = 100;
	my.function = fade_particle();
}



Re: Problem with fading particle [Re: Toon] #291887
09/28/09 18:35
09/28/09 18:35
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
not tested but here should be your problem:

my.function = fade_particle();

You call fade_particle by using the two brackets () and you assign my.function the returned value of fade_particle. Thus the correct version should be the following
my.function = fade_particle;


On the other hand always control time dependant instructions using the "time" variable as you did with my.alpha =>

my.size -= 1 * time; // otherwise it will fade out slower/faster on different framerates/PCs


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends

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