Gamestudio Links
Zorro Links
Newest Posts
SGT_FW
by Aku_Aku. 11/30/26 08:19
Removing outliers from files
by JeyKey II. 11/29/26 10:01
Experiences with cTrader
by JeyKey II. 11/27/26 09:04
make a complaint
by EW_bytes. 11/26/26 23:00
FXCM => AVA Trade Plugin???
by Martin_HH. 11/25/26 21:59
No connection to MT4
by Martin_HH. 11/23/26 06:38
MinMax function on History t6 file
by LucasJoshua. 11/21/26 14:28
What are you working on?
by rayp. 11/20/26 18:10
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
2 registered members (Quad, Martin_HH), 6,771 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
EvanTJ, rht, MaliceTheMaker, Haitao_Ren, JimSimons
19250 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