cursor particles

Posted By: VeT

cursor particles - 07/02/09 14:11



looking like they ignores lifetime... what to do? smile
Code:
///////////////////////////////
#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);
	}
}


Posted By: the_mehmaster

Re: cursor particles - 07/02/09 21:03

what is your alpha threshold?

If it's 50 (default) your code won't work..

set it to 0 or 1:
Quote:
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..
Posted By: VeT

Re: cursor particles - 07/03/09 08:33

No, neither 0, nor 1 changes nothing frown
Posted By: the_mehmaster

Re: cursor particles - 07/03/09 10:02

sorry i can't be of more help..

If you don't get an answer soon, post in the 'ask the developers' forum.
Posted By: VeT

Re: cursor particles - 07/03/09 10:13

Code:
#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 smile
Posted By: Germanunkol

Re: cursor particles - 07/06/09 16:07

Yeah. Always multiply with time_step...
So was that the problem?
Posted By: VeT

Re: cursor particles - 07/06/09 16:42

I dont know, i just get another working code.. Try the first one and you'll see smile
© 2024 lite-C Forums