|
Explosion in mouse coordinated
#209970
06/06/08 23:14
06/06/08 23:14
|
Joined: Apr 2006
Posts: 10 Brasil
alves
OP
Newbie
|
OP
Newbie
Joined: Apr 2006
Posts: 10
Brasil
|
Simple explosion, on top of the click.
#include <acknex.h>
#include <default.c>
SOUND* Explosion_wav = "Explosion.wav";
BMAP* Fire_tga = "Fire.tga";
function VecRandomize(var *vec, var range);
function FadeParticle(PARTICLE *p);
function Fire(PARTICLE *p);
function Explosion();
VECTOR ParticlePos;
/* Main Function
---------------------------------*/
function main()
{
mouse_mode = 2;
level_load("Explosao.wmb");
wait(2);
while(1)
{
on_mouse_left = Explosion;
vec_set(mouse_pos, mouse_cursor);
vec_set(ParticlePos, mouse_pos);
wait(1);
}
}
function Explosion()
{
ParticlePos.z = 200;
snd_play(Explosion_wav, 100, 1);
vec_for_screen(ParticlePos, camera);
effect(Fire, 1000, ParticlePos, normal);
}
/* Particle Generator
-------------------------------*/
function Fire(PARTICLE *p)
{
var temp[3];
VecRandomize(temp, 10);
vec_add(p.vel_x, temp);
p.alpha = 25 + random(25);
p.bmap = Fire_tga;
p.flags |= (BRIGHT | MOVE);
p.event = FadeParticle;
}
/* Dist and Direction of particle
---------------------------------------------------------*/
function VecRandomize(var *vec, var range)
{
vec[0] = random(1) - 0.5;
vec[1] = random(1) - 0.5;
vec[2] = random(1) - 0.5;
vec_normalize(vec, random(range));
}
/* Particle life
-------------------------------*/
function FadeParticle(PARTICLE *p)
{
p.alpha -= 2 * time_step;
if(p.alpha <= 0)p.lifespan = 0;
}
Executavel
|
|
|
Re: Explosion in mouse coordinated
[Re: PadMalcom]
#210080
06/07/08 19:01
06/07/08 19:01
|
Joined: Apr 2006
Posts: 10 Brasil
alves
OP
Newbie
|
OP
Newbie
Joined: Apr 2006
Posts: 10
Brasil
|
Change the "on_mouse_left = Explosion," in main function for:
if(mouse_left == ON)
{
Explosion();
wait(-2);
}
In the "wait ()", you set the waiting time.
Last edited by alves; 06/07/08 19:02.
|
|
|
Re: Explosion in mouse coordinated
[Re: alves]
#210167
06/08/08 15:17
06/08/08 15:17
|
Joined: Apr 2007
Posts: 582 Germany
Poison
User
|
User
Joined: Apr 2007
Posts: 582
Germany
|
wow, looks awesome. Thank you alves.
Everything is possible, just Do it!
|
|
|
Re: Explosion in mouse coordinated
[Re: Poison]
#210557
06/11/08 14:19
06/11/08 14:19
|
Joined: Aug 2002
Posts: 673 Las Cruces, NM
JimFox
User
|
User
Joined: Aug 2002
Posts: 673
Las Cruces, NM
|
Hi, I usually groan when I see "rapidshare" as the file location. But this time it downloaded very easily. No problem. Thanks for a nice little effect!! Best regards,
Jim
|
|
|
|