Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (Grant, TipmyPip, AndrewAMD), 12,724 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Change particle's direction path halfway through it's lifespan? #334664
07/24/10 14:29
07/24/10 14:29
Joined: May 2010
Posts: 8
Singapore
C
CaedLucin Offline OP
Newbie
CaedLucin  Offline OP
Newbie
C

Joined: May 2010
Posts: 8
Singapore
Hello there! I am relatively new to lite c and currently i'm doing an assignment that requires me to do a few different particle effects.

So i thought of doing a particle effect that works like a shooting star, but halfway through it's flight, it would do a 360 degrees circle flip and continue it way in the same direction.

I was wondering let's say i set a certain particle to a relatively long lifespan let's say 10 seconds. and it's event i call upon another function which would check with an "if" condition that should the lifespan falls to 5 seconds and i would change the particle's velocity x, y and z with a certain circlular motion formula.

x = radius * cos(angle)
y = radius * sin(angle)

Is it possible at all? Because i tried it and it doesn't work. I hope someone would help me with this. Thank you!

Re: Change particle's direction path halfway through it's lifespan? [Re: CaedLucin] #334669
07/24/10 15:01
07/24/10 15:01
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
var radius = 32;

function part_circle(PARTICLE* p) {

if(p.lifespan < 100 && p.skill_a == 1) {
p.skill_b += 5*time_step;
if(p.skill_b > 360) { p.skill_a = 0;}
else {
p.x = p.skill_c+radius*cos(p.skill_b);
p.y = p.skill_d+radius*sin(p.skill_b);
}
}

else {
vec_add(p.x,vector(p.vel_x*time_step,p.vel_y*time_step,p.vel_z*time_step));
p.skill_c = p.x;
p.skill_d = p.y;
}

}

function part_circle(PARTICLE* p) {
p.vel_x = ...
// do NOT (!) set p's MOVE flag
...
p.lifespan = 160;
p.skill_a = 1;
p.event = part_circle_move;
}

Untested.


"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 | 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