Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (AndrewAMD, alibaba, Konsti, 2 invisible), 1,418 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Particle #229107
09/24/08 15:08
09/24/08 15:08
Joined: May 2004
Posts: 152
Germany / Dresden
Thomas Offline OP
Member
Thomas  Offline OP
Member

Joined: May 2004
Posts: 152
Germany / Dresden
Hi all

How can one drive out a Particleeffekt before a player? and how puts one out him again???


Hallo an alle

Wie kann ich einen Particleeffekt genau vor dem Spieler erzeugen.
Und wie mach ich es das er per Tastendruck wieder ausgeht!

ist für C Script aus Easy Particle 3

bmap ray_farbe1 = <ray_red.tga>;
VAR SternenstaubAnzahlPartikel = 1; //number of particles used for this effect


Function Sternenstaub_spec_fun()
{
my.alpha -= 0 *time;
IF(My.alpha < 0) { my.alpha = 0; my.lifespan = 0; }
my.skill_b += 0.03;
my.skill_c = 6 - my.skill_b;
if(my.skill_c < 0) { my.lifespan = 0; }
}

Function Sternenstaubspezial()
{
my.blue = 128 ;
my.green = 128 ;
my.red = 128 ;
my.skill_c = 0; my.skill_b = 0;
my.bmap = ray_farbe1; //the effect bitmap
my.vel_x = -40 ;
my.vel_y = random( 0 ) - 0 ;
my.vel_z = random( 0 ) - 0 ;
my.size = 1 ;
my.alpha = 100 ;
my.x += random(1000)-500;
my.y += random(1000)-500;
my.z += random(100)-50;
my.gravity = 0 ;
my.streak = off;
my.flare = on;
my.bright = on;
my.beam = on;
my.move = on;
my.transparent = on;
my.function = Sternenstaub_spec_fun;
}


Function Sternenstaub()
{
while(1)
{
SternenstaubAnzahlPartikel = 1;
var myPos[3];

vec_set(myPOS,player.x);
vec_set(camera.x, player.x);
temp.x = COS(camera.pan);
temp.y = SIN(camera.pan);
temp.Z = COS(camera.tilt);
MyPos.X = myPos.X + temp.X*temp.X;
MyPos.Y = myPos.Y + temp.X*temp.Y;
MyPos.Z = myPos.Z + temp.X*temp.Z;
MyPos.X = Camera.X + 400;

effect(Sternenstaubspezial,max(1,int(SternenstaubAnzahlPartikel*time)),MyPOS,nullvector);
wait(1);
}
}


action Sternenstaub_action
{
my.invisible = on;
My.passable = on;
while(!key_s) { wait(1); }
Sternenstaub();
}

Re: Particle [Re: Thomas] #229410
09/27/08 11:05
09/27/08 11:05
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
To create a particle effect right in front of an entity (in this case the "player" entity) you first need to find the position which is right in front of it.
This can be done with the following snippet:
Code:
var particle_dist[3] = 50,0,0; // effect is 50 quants in front of the player

function particle_StartEffect()
{
  var effect_pos[3];
  
  vec_set(effect_pos, particle_dist);
  vec_rotate(effect_pos, player.pan);
  vec_add(effect_pos, player.x);
}

Now the vector "effect_pos" contains the position in front of the player entity based upon the particle_dist vector and the rotation of the player entity.

Next thing to do is to implement the toggle behaviour, this can be achieved with a "control" variable:
Code:
var particle_status = 0;
var particle_dist[3] = 50,0,0; // effect is 50 quants in front of the player

function particle_ToggleEffect()
{
  var effect_pos[3];
  
  particle_status = !particle_status; //inverting the current status, thus 0 gets 1 and 1 gets 0
  while(particle_status)
  {
    vec_set(effect_pos, particle_dist);
    vec_rotate(effect_pos, player.pan);
    vec_add(effect_pos, player.x);
    
    effect(yourEffect,5,effect_pos,nullvector);
    wait(1);
  }
}

on_p = particle_ToggleEffect;

That should do the job.

Attention: I wrote this script from the top of my head, thus I'm not 100% sure that each instruction is correct, but I'll check if you have problems with it.

Re: Particle [Re: Xarthor] #229467
09/27/08 19:24
09/27/08 19:24
Joined: May 2004
Posts: 152
Germany / Dresden
Thomas Offline OP
Member
Thomas  Offline OP
Member

Joined: May 2004
Posts: 152
Germany / Dresden
ok thanks i´ll try it.

ok danke ich werde es versuchen.

mfg thomas

Re: Particle [Re: Thomas] #229515
09/28/08 10:00
09/28/08 10:00
Joined: May 2004
Posts: 152
Germany / Dresden
Thomas Offline OP
Member
Thomas  Offline OP
Member

Joined: May 2004
Posts: 152
Germany / Dresden
Leider dreht sich der Effekt nicht mit dem Player bzw mit der Cam.

Re: Particle [Re: Thomas] #229552
09/28/08 15:22
09/28/08 15:22
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Meinst du die position des effekts oder die richtung in die sich die partikel bewegen?

Re: Particle [Re: Xarthor] #229563
09/28/08 16:35
09/28/08 16:35
Joined: May 2004
Posts: 152
Germany / Dresden
Thomas Offline OP
Member
Thomas  Offline OP
Member

Joined: May 2004
Posts: 152
Germany / Dresden
Die Position des Effektes.
Die Richtung der Particle stimmt aber wenn ich den Player bewege bleibt die Position des Effektes nicht vor dem Player.

MFG Thomas


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