Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 17,758 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
spray direction #199709
04/01/08 06:38
04/01/08 06:38
Joined: Apr 2007
Posts: 83
prog Offline OP
Junior Member
prog  Offline OP
Junior Member

Joined: Apr 2007
Posts: 83
Hello,
I want the smoke to come out in the direction of the player,i.e,
it should look like as if the player is spraying.

This is the code i am using and the player is PlBiped(A6 template).

BMAP px_tga = "smog_02.tga";
function fade_p()
{
my.alpha -= 10 * time_step;
if (my.alpha < 0) {my.lifespan = 0;}
}


function effect_x()
{
my.alpha = 30 + random(65);
my.flare = on;
my.bmap = px_tga;
my.size = 12;
my.bright = on;
my.move = on;
my.function = fade_p;
}

function create_px()
{
var temp_pos;
var temp_var;
while (1)
{
temp_pos.x += 20 * cos(plBiped01_entity.x); // 20 = particle radius
temp_pos.y += 20 * sin(plBiped01_entity.x); // use the same value here
effect(effect_x, 1, temp_pos.x, nullvector);
wait (1);
}
}
on_m = create_px;

Last edited by prog; 04/01/08 06:39.
Re: spray direction [Re: prog] #199929
04/01/08 19:00
04/01/08 19:00
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
Do you have a problem as well? :P


Click and join the 3dgs irc community!
Room: #3dgs
Re: spray direction [Re: Joozey] #200006
04/02/08 05:49
04/02/08 05:49
Joined: Apr 2007
Posts: 83
prog Offline OP
Junior Member
prog  Offline OP
Junior Member

Joined: Apr 2007
Posts: 83
The problem is that the smoke is not coming in the players direction,
it is comming from behind the player and perpendicular to the player direction.

Re: spray direction [Re: prog] #200056
04/02/08 12:25
04/02/08 12:25
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline
Expert
Germanunkol  Offline
Expert

Joined: Jun 2006
Posts: 2,640
Earth
instead of:

while (1)
{
temp_pos.x += 20 * cos(plBiped01_entity.x); // 20 = particle radius
temp_pos.y += 20 * sin(plBiped01_entity.x); // use the same value here
effect(effect_x, 1, temp_pos.x, nullvector);
wait (1);
}

try:

while (1)
{
vec_set(temp,vector(20,0,0));
vec_rotate(temp,(plBiped01_entity.pan);
vec_add(temp,(plBiped01_entity.x);
effect(effect_x, 1, temp, nullvector);
wait (1);
}

also, temp_pos is not a vector, the way you're defining it, but you're acting like it is.


~"I never let school interfere with my education"~
-Mark Twain
Re: spray direction [Re: Germanunkol] #200361
04/03/08 17:44
04/03/08 17:44
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline
Expert
Germanunkol  Offline
Expert

Joined: Jun 2006
Posts: 2,640
Earth
did it work?


~"I never let school interfere with my education"~
-Mark Twain
Re: spray direction [Re: Germanunkol] #201777
04/11/08 05:40
04/11/08 05:40
Joined: Apr 2007
Posts: 83
prog Offline OP
Junior Member
prog  Offline OP
Junior Member

Joined: Apr 2007
Posts: 83
hi germanukol,

Thank you, ya it is attaching the smoke(smog_02.tga) to the player, but its not spraying i.e, the spray effect is not seen, only the tga is attached to the player.
And also the smoke(tga) is attached to the player throughout the game, but after spraying the smoke should be invisible(only player should be visible).

Re: spray direction [Re: prog] #201788
04/11/08 07:19
04/11/08 07:19
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
So the smoke should spray only once and not through out the entire game?
Please list what exactly you are looking for and where your problem is, that would make it easier to help you.

Thanks and have a nice day.

Re: spray direction [Re: Xarthor] #201801
04/11/08 08:54
04/11/08 08:54
Joined: Apr 2007
Posts: 83
prog Offline OP
Junior Member
prog  Offline OP
Junior Member

Joined: Apr 2007
Posts: 83
Ya, the smoke should spray only once, not through out the game.
The game has 4 levels and only in 2nd level smoke has to be sprayed and only once(ie., when 'M' is presses and should stop after we release 'M')
after that the player has to perform other actions(ie., has to go and touch the skycar...). But using the below code.., the smoke is visible throught out the game(ie., in all the levels after we execute this function).

But, it has to spray when we click on_M and stop spraying after we release the button.

 Code:
BMAP px_tga = "smog_02.tga";
function fade_p()
{
my.alpha -= 10 * time_step;
if (my.alpha < 0) {my.lifespan = 0;}
}


function effect_x()
{
my.alpha = 30 + random(65);
my.flare = on;
my.bmap = px_tga;
my.size = 12;
my.bright = on;
my.move = on;
my.function = fade_p;
}
function create_px()
{
while (1)
{
vec_set(temp,vector(20,0,0));
vec_rotate(temp,(plBiped01_entity.pan);
vec_add(temp,(plBiped01_entity.x);
effect(effect_x, 1, temp, nullvector);
wait (1);
}
}
on_m = create_px;


Re: spray direction [Re: prog] #201810
04/11/08 10:24
04/11/08 10:24
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
I don't know whether this is reasonable within the whole of your game, but it should do the task, although not tested.

function create_px()
{
while (1)
{
add here:if(key_m)
add here:{
vec_set(temp,vector(20,0,0));
vec_rotate(temp,(plBiped01_entity.pan);
vec_add(temp,(plBiped01_entity.x);
effect(effect_x, 1, temp, nullvector);
add here:}
wait (1);
}
}
remove this line:on_m = create_px;

-----------
BTW: How can I format this as code?

Re: spray direction [Re: Pappenheimer] #201814
04/11/08 10:46
04/11/08 10:46
Joined: Apr 2007
Posts: 83
prog Offline OP
Junior Member
prog  Offline OP
Junior Member

Joined: Apr 2007
Posts: 83
Thank u,
but this is not working ie.,if(key_m) is not working..


Add the code: between [code][/code] to format this as code.


Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | 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