2 registered members (AbrahamR, 1 invisible),
858
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
cursor particles
#275850
07/02/09 14:11
07/02/09 14:11
|
Joined: Aug 2004
Posts: 1,345 Kyiv, Ukraine
VeT
OP
Serious User
|
OP
Serious User
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
|
looking like they ignores lifetime... what to do?
///////////////////////////////
#include <acknex.h>
#include <default.c>
BMAP* arrow_pcx = "arrow.pcx";
BMAP* snow_tga = "dampf.tga";
///////////////////////////////
function main()
{
vec_set(screen_size,vector(800,600,0));
vec_set(screen_color,vector(50,1,1)); // dark blue
vec_set(sky_color,vector(50,1,1)); // dark blue
video_window(NULL,NULL,0,"My New Game");
d3d_antialias = 1;
shadow_stencil = 3;
random_seed(0);
level_load("level1.wmb");
}
function mouse_startup()
{
mouse_mode = 2;
mouse_map = arrow_pcx;
while (1)
{
vec_set(mouse_pos, mouse_cursor);
wait(1);
}
}
function fade_part(PARTICLE *p)
{
p.alpha -= 20;
if (p.alpha < 0) {p.lifespan = 0;}
}
function p_mouse_particles(PARTICLE* p)
{
/*
VECTOR particle_direction;
particle_direction.x = (random(1) - 2)*0.01;
particle_direction.y = 0; //(random(1) - 2)*0.01;
particle_direction.z = 0; //0.01 * random(1);
vec_add(p.vel_x, particle_direction);
*/
p.alpha = 30 + random(20);
p.size = 0.5;
p.bmap = snow_tga;
set(p, MOVE | BRIGHT | TRANSLUCENT );
my.event = fade_part;
}
function particles_startup()
{
VECTOR particle_origin;
while (1)
{
particle_origin.x = mouse_pos.x;
particle_origin.y = mouse_pos.y;
particle_origin.z = 40;
vec_for_screen (particle_origin, camera);
effect(p_mouse_particles, 1, particle_origin.x, vector(0,0,1));
wait (1);
}
}
|
|
|
Re: cursor particles
[Re: VeT]
#275953
07/02/09 21:03
07/02/09 21:03
|
Joined: Dec 2008
Posts: 528 Wagga, Australia
the_mehmaster
User
|
User
Joined: Dec 2008
Posts: 528
Wagga, Australia
|
what is your alpha threshold? If it's 50 (default) your code won't work.. set it to 0 or 1: d3d_alpharef Determines the transparency threshold for overlay textures. Pixels below this threshold are completely transparent. By adjusting this variable, seams around the transparent parts of overlay images can be minimized.
Range: 0..255 (default: 127 = 50%) Hope this helps..
|
|
|
Re: cursor particles
[Re: the_mehmaster]
#276052
07/03/09 10:13
07/03/09 10:13
|
Joined: Aug 2004
Posts: 1,345 Kyiv, Ukraine
VeT
OP
Serious User
|
OP
Serious User
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
|
#include <acknex.h>
#include <default.c>
BMAP* arrow_pcx = "arrow.pcx";
function mouse_startup()
{
mouse_mode = 2;
mouse_map = arrow_pcx;
while (1)
{
vec_set(mouse_pos, mouse_cursor);
wait(1);
}
}
function vec_randomize (VECTOR* vec, var range)
{
vec_set(vec,vector(random(1)-0.5,random(1)-0.5,random(1)-0.5));
vec_normalize(vec,random(range));
}
// helper function: fades out a particle
function p_alphafade(PARTICLE *p)
{
p.alpha -= 20*time_step;
if (p.alpha <= 0) p.lifespan = 0;
}
function p_fountain(PARTICLE* p)
{
VECTOR vTemp;
vec_randomize(vTemp,0.5);
vec_add(p.vel_x,vTemp);
vec_set(p.blue,vector(255,255,255));
set(p, MOVE | TRANSLUCENT);
p.alpha = 100;
p.size = 0.75;
p.gravity = 0.1;
p.event = p_alphafade;
}
function main()
{
level_load(NULL);
video_window(NULL,NULL,112,"Particle demo");
vec_set(camera.x,vector(-150,0,50));
vec_set(sky_color,vector(50,0,0)); // dark blue
VECTOR particle_origin;
while (1)
{
particle_origin.x = mouse_pos.x;
particle_origin.y = mouse_pos.y;
particle_origin.z = 40;
vec_for_screen (particle_origin, camera);
// effect(p_mouse_particles, 1, particle_origin.x, vector(0,0,0.1));
effect(p_fountain,minv(1,40*time_step),particle_origin.x,vector(0,0,2));
wait (1);
}
// effect(p_fountain,minv(1,40*time_step),vector(0,0,0),vector(0,0,2));
}
i got what i wanted, thanks
|
|
|
Re: cursor particles
[Re: VeT]
#276819
07/06/09 16:07
07/06/09 16:07
|
Joined: Jun 2006
Posts: 2,640 Earth
Germanunkol
Expert
|
Expert
Joined: Jun 2006
Posts: 2,640
Earth
|
Yeah. Always multiply with time_step... So was that the problem?
~"I never let school interfere with my education"~ -Mark Twain
|
|
|
|