2 registered members (AndrewAMD, Ayumi),
1,405
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: change blue Vector in Particle event
[Re: 3run]
#458847
04/02/16 17:42
04/02/16 17:42
|
Joined: Mar 2014
Posts: 359
CocaCola
OP
Senior Member
|
OP
Senior Member
Joined: Mar 2014
Posts: 359
|
maby I make something wrong, but it doesenīt work. Itīs a white picture and this code
///////////////////////////////
#include <acknex.h>
#include <default.c>
#include <particles.c>
///////////////////////////////
function p_alphafade(PARTICLE *p)
{
p.alpha -= p.skill_a*time_step;
if (p.alpha <= 80)vec_set(p.blue,vector(0,55,255));
if (p.alpha <= 55)vec_set(p.blue,vector(0,0,55));
if (p.alpha <= 25)vec_set(p.blue,vector(0,0,0));
if (p.alpha <= 0) p.lifespan = 0;
}
function spriteraketeexpfunc(ENTITY* p){
VECTOR vTemp;
vec_randomize(vTemp,1);
vec_add(p._VEL_X,vTemp);
vec_set(p.blue,vector(15,255,255));
set(p, _MOVE | TRANSLUCENT);
p.alpha = 100;
p._SIZE = 2;
p._GRAVITY = 0.2;
p._FADE = 3; // fade factor
p.event = p_fade_sprite;
}
function spriteraketefly(){
var numberp=10;
VECTOR temp;
while(1){
if(key_space){
vec_set(temp.x,vector(0.2,0,0));
effect_sprite ("wolke.tga",spriteraketeexpfunc,10 ,my.x , temp.x);
}
wait(1);
}
}
function main()
{
video_window(NULL,NULL,0,"My New Game");
d3d_antialias = 9;
shadow_stencil = 0;
level_load(NULL);
vec_set(camera.x,vector(0,0,70));
vec_set(camera.pan,vector(0,-90,0));
ent_create("rakete1.mdl",nullvector,spriteraketefly);
}
Last edited by CocaCola; 04/02/16 17:44.
|
|
|
Re: change blue Vector in Particle event
[Re: 3run]
#458849
04/02/16 19:12
04/02/16 19:12
|
Joined: Mar 2014
Posts: 359
CocaCola
OP
Senior Member
|
OP
Senior Member
Joined: Mar 2014
Posts: 359
|
thx, now I understand the mistake, but how I put a png to particle? I think I create a particle withe the effect function, is it ok? In the manual is it define in this case:
effect (function, var number, VECTOR* pos, VECTOR* vel)
I do not see the place for the png String.
|
|
|
Re: change blue Vector in Particle event
[Re: CocaCola]
#458850
04/02/16 19:32
04/02/16 19:32
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
Senior Expert
|
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
I do not see the place for the png String. You don't use String or anything like that, you don't need to 'place' png there. I just wanted to say that I used a .png image file format (like .pcx, .tga, .dds etc) Best regards!
|
|
|
Re: change blue Vector in Particle event
[Re: 3run]
#458851
04/02/16 19:46
04/02/16 19:46
|
Joined: Mar 2014
Posts: 359
CocaCola
OP
Senior Member
|
OP
Senior Member
Joined: Mar 2014
Posts: 359
|
I find many mistakes lice ENTITY not PARTICLE and wrong link. No I understand that Praticles are only pointer Thx for the tip with the ambient=100; now itīs works: the Particle is going be red
function exp_fade(ENTITY *p)
{
p.alpha -= p.skill_b*time_step;
p.blue -=p.skill_b*time_step;
p.green -=p.skill_b*time_step;
if (p.alpha <= 0) p._LIFESPAN = 0;
}
function spriteraketeexpfunc(ENTITY* p){
VECTOR vTemp;
set(p,LIGHT);
p.ambient=100;
vec_randomize(vTemp,10);
vec_add(p._VEL_X,vTemp);
vec_set(p.blue,vector(0,0,0));
set(p, _MOVE | TRANSLUCENT);
p.alpha = 100;
p._SIZE = 2;
p.skill_b=15;
p._GRAVITY = 0.2;
p._FADE = 1; // fade factor
p.event = exp_fade;
}
|
|
|
|