Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by Zheka. 06/20/24 14:26
Lapsa's very own thread
by rki. 06/19/24 11:27
A simple game ...
by VoroneTZ. 06/18/24 10:50
Face player all the time ...
by bbn1982. 06/18/24 10:25
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,298 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mino, squik, AemStones, LucasJoshua, Baklazhan
19061 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
how do I stop particles from emitting? #308383
02/03/10 01:14
02/03/10 01:14
Joined: Dec 2009
Posts: 71
N
ncc1701d Offline OP
Junior Member
ncc1701d  Offline OP
Junior Member
N

Joined: Dec 2009
Posts: 71
newby here: maybe I missed in manual but.
...
Just wondering how do you stop emmitting particles once they have started?
I dont want to hide or unhide but turn off emitter so that last particle fades away as the fountain so to speak stops creating new particles in mid game play.

take for example the demo they show in manuals under the search word particles as an example.
How would you stop them in that case?
thanks

Last edited by ncc1701d; 02/03/10 01:15.
Re: how do I stop particles from emitting? [Re: ncc1701d] #308385
02/03/10 01:24
02/03/10 01:24
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline
Expert
Espér  Offline
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
uhm..

two ways:

1st:
Your particle emitter code has a while loop. just replace "while(1)" with "while(var == 0)"
When you set the var to a value other than 0, the loop breaks.. particle emitting stops


2nd:
you call the emitting code from another function ( emitting code has no while loop ) every frame.
Then just stop calling the emitting code.


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: how do I stop particles from emitting? [Re: Espér] #308403
02/03/10 08:39
02/03/10 08:39
Joined: Dec 2009
Posts: 71
N
ncc1701d Offline OP
Junior Member
ncc1701d  Offline OP
Junior Member
N

Joined: Dec 2009
Posts: 71
maybe you could tell me how what your saying fits into the context of what I am doing. I start the particle effect when pressing f1 but I cant get it to stop when release the key.
here is the the code:

#include <acknex.h>
#include <default.c>
#include <atypes.h>
//////////////////////////////

VECTOR* vTemp;
function p_fountain(PARTICLE* p)
{
set(p, MOVE | BRIGHT);
}

void start_particle_while_key(int key, VECTOR* vec)
{
while(1)
{
effect(p_fountain,maxv(1,40*time_step),vector(0,0,0),vector(0,0,4));
wait(1);
}
//stop effect code here I would think
}

function key_down(key) //captures ALL key presses
{
switch(key)
{
case 59:
start_particle_while_key(59, vTemp);
break;
}
}

function main()
{
on_anykey = key_down;//tell any key press to call this function
level_load(NULL);
vec_set(camera.x,vector(-150,0,50));
}

Last edited by ncc1701d; 02/03/10 08:41.
Re: how do I stop particles from emitting? [Re: ncc1701d] #308432
02/03/10 10:41
02/03/10 10:41
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline
Expert
Espér  Offline
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
create a new variable
Code:
var stopme = 0;




replace
Code:
while(1)
{
effect(p_fountain,maxv(1,40*time_step),vector(0,0,0),vector(0,0,4));
wait(1);
}


with
Code:
while(stopme == 0)
{
effect(p_fountain,maxv(1,40*time_step),vector(0,0,0),vector(0,0,4));
wait(1);
}




After that, add a new case to you keyswitch:
Code:
switch(key)
{
case 59:
start_particle_while_key(59, vTemp);
break;

case 0: // no key hitten
stopme = 1;
wait(2);
stopme = 0;
break;
}




*not tested.. at the moment, i´m at work and have no GStudio here*


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: how do I stop particles from emitting? [Re: Espér] #308456
02/03/10 11:25
02/03/10 11:25
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
... or replace:
while(1)
with
while(key_pressed (key)) // key is 59 in the function, Scancode 59 = F1

The while breaks if you release the F1

Re: how do I stop particles from emitting? [Re: Widi] #308580
02/03/10 18:57
02/03/10 18:57
Joined: Dec 2009
Posts: 71
N
ncc1701d Offline OP
Junior Member
ncc1701d  Offline OP
Junior Member
N

Joined: Dec 2009
Posts: 71
Thanks everyone!


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