Gamestudio Links
Zorro Links
Newest Posts
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Akow, tomaslolo), 1,536 guests, and 12 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Particle Trig #132772
05/30/07 20:04
05/30/07 20:04
Joined: Jan 2007
Posts: 110
USA East Coast
K
KojaK Offline OP
Member
KojaK  Offline OP
Member
K

Joined: Jan 2007
Posts: 110
USA East Coast
How do I make a particle go a certain direction relative to the player or the normal of a collision during c_trace or c_move? I understand the x y z thing, but how do I turn a point into a velocity for a particle, or use the normal of a surface to make a particle go a certain way?

I have a blood effect that I want the blood to come tward the player, and away from the player when the enemy is shot. I also want a smoke-ish particle to come off the normal of a wall, when it is shot by a c_trace.


Lead programmer for Two Screws Loose Click here for our forums, and downloads for our games
Re: Particle Trig [Re: KojaK] #132773
05/30/07 20:15
05/30/07 20:15
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
use vec_add with vel_x and vel_y and vec_diff
about walls... use vec_to_angle(my.pan,normal); //sprite pan


Never say never.
Re: Particle Trig [Re: KojaK] #132774
05/30/07 20:15
05/30/07 20:15
Joined: May 2004
Posts: 1,510
Denmark
Claus_N Offline
Serious User
Claus_N  Offline
Serious User

Joined: May 2004
Posts: 1,510
Denmark
From the manual (look for "effect" or "effect_local"):
Code:
// helper function: sets the vector to random direction   and length
function vec_randomize (&vec, range)
{
vec[0] = random(1) - 0.5;
vec[1] = random(1) - 0.5;
vec[2] = random(1) - 0.5;
vec_normalize(vec,random(range));
}

// helper function: fades out a particle
function part_alphafade()
{
my.alpha -= time + time;
if (my.alpha <= 0) { my.lifespan = 0; }
}

// particle function: generates a fading explosion into vel direction
function effect_explo()
{
vec_randomize(temp,10);
vec_add (my.vel_x, temp);
my.alpha = 25 + random(25);
my.bmap = scatter_map;
my.flare = on;
my.bright = on;
my.move = on;
my.function = part_alphafade; // change to a shorter, faster function
}

...
vec_scale(normal,10); // produce an explosion into the normal direction
effect(effect_explo,1000,my.x,normal);



It uses the last parameter of the "effect" function to set the velocity vector of the particles, to the normal-direction.

Re: Particle Trig [Re: Claus_N] #132775
05/30/07 20:47
05/30/07 20:47
Joined: Jan 2007
Posts: 110
USA East Coast
K
KojaK Offline OP
Member
KojaK  Offline OP
Member
K

Joined: Jan 2007
Posts: 110
USA East Coast
Ok, can you make the direction relative the the player part a little more clear?

I don't really understand how to use the vec_add and vec_diff...


Lead programmer for Two Screws Loose Click here for our forums, and downloads for our games

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