Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Gassy!!! (https://forums.graalonline.com/forums/showthread.php?t=75829)

Angel_Light 07-24-2007 04:39 PM

Gassy!!!
 
1 Attachment(s)
PHP Code:

//#CLIENTSIDE
// Made by Mr. Omega
//Inspired by a script of Napo
function onCreated() {
  
onTimeOut();
  
this.on = 0;
}

function 
onWeaponFired() {
  if ( 
this.on == 0)
  {
    
this.on = 1;
  
    
with ( findimg( 200)) {     
      
layer = 2;
      
emitter.delaymin = 0.1;
      
emitter.delaymax = 0.5;
      
emitter.nrofparticles = 1;

      
emitter.particle.lifetime = 3;
      
emitter.particle.image = "g4_particle_smoke.png";
      
emitter.particle.mode  = 1;
      
emitter.particle.red   = 0;
      
emitter.particle.green = 1;
      
emitter.particle.blue  = 0;
      
emitter.particle.alpha = 0.6;
      
emitter.particle.zoom  = 0.5;
      
emitter.particle.speed = 4;
      
      
emitter.addglobalmodifier("range", 0, 1000, "movex", "add", -4, -10);
      
emitter.addglobalmodifier("impulse", 0.2, 0.2, "spin", "multiply", 0.9, 0.9);
      
emitter.addlocalmodifier("once", 0, 0, "angle", "add", -0.2, 0.2);
      
emitter.addlocalmodifier("once", 0, 0, "rotation", "replace", 0, 2*pi);
      
emitter.addlocalmodifier("range", 1, 3, "alpha", "replace", 0.6, 0);
      
emitter.addlocalmodifier("range", 0, 3, "zoom", "add", 0.5, 0.25);
      
emitter.addlocalmodifier("range", 0, 0.5, "speed", "replace", 8, 4);
      
emitter.addlocalmodifier("range", 0.5, 3, "speed", "replace", 4, 1.5);
      
emitter.addlocalmodifier("once", 0, 0, "spin", "replace", 2, 4);
    }
  }

  else if ( 
this.on == 1)
  {
    
hideImg( 200);
    
this.on = 0;
  }
}

function 
onTimeOut() {
  if (
this.on == 1)
  {
    
with( findImg( 200)) {
      if (
player.dir == 0)
      {
        
x = player.x-0.5;
        
y = player.y+1;
        
layer = 2;
        
emitter.particle.angle = pi*3/2;
      }
      
      if (
player.dir == 1)
      {
        
x = player.x+1;
        
y = player.y+0.3;
        
layer = 2;
        
emitter.particle.angle = 0;
      }
      
      if (
player.dir == 2)
      {
        
x = player.x-0.3;
        
y = player.y-0.5;
        
layer = 0;
        
emitter.particle.angle = pi/2;
      }
      
      if (
player.dir == 3)
      {
        
x = player.x-2;
        
y = player.y+0.3;
        
layer = 2;
        
emitter.particle.angle = pi;
      }
    }
  }
  
  
setTimer( 0.05);
} 

Just press D to use it ;]

Here's a vid of what it does.

Twinny 07-24-2007 04:56 PM

Quote:

Originally Posted by Angel_Light (Post 1333970)
Here's a vid of what it does.

I can almost see the video! So close....

Anyhoo, the else if () isn't really necessary...it's a boolean condition. You could have also done if (this.on) {} else {}. Also, do setTimer(0) in the else part and add setTimer(0.05); to save the timeout from running when it's not needed.

Angel_Light 07-24-2007 05:01 PM

sorry the vid took some time to upload, and also because I choose not too :P

theHAWKER 07-28-2007 06:48 PM

good job xD, the video's a bit much of a file size...


All times are GMT +2. The time now is 10:38 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.