Thread: Virtual Welding
View Single Post
  #19  
Old 12-01-2011, 03:09 PM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
If anyone's interested in the finished script, here it is.
I may add a blue particle effect in the centre for the realism, at a later date.
PHP Code:
//#CLIENTSIDE
function onCreated() {
  
hideimgs(200100000);
  
this.indexn 200;
  
onTimeout();
}

function 
onMouseDown(var) {
  if (var == 
"left") {
    
this.mode "on";
    
Spark();
  }
}

function 
onMouseUp(var) {
  if (var == 
"left") {
    
this.mode "off";
    
emitter.destroy();
    
emitter.removeparticles();
    
emitter.removemodifiers();
  }
}

function 
onTimeout() {
  if (
this.mode == "on") {
    
this.indexn += 1;
    
showimg(this.indexn"g4_particle_sun.png"mousex 2mousey 2);
    
findimg(this.indexn).zoom random(0.20.3);
    
findimg(this.indexn).red 1;
    
findimg(this.indexn).green 1;
    
findimg(this.indexn).blue 1;
    
findimg(1000000).findimg(this.indexn).1.2;
    
findimg(1000000).findimg(this.indexn).0.8;
    
with(findimg(1000000)) {
      
emitter.emit();
    }
  }
  
settimer(0.05);
}

function 
Spark() {
  
with(findimg(1000000)) {
    
spin degtorad(0);
    
rotation degtorad(0);
    
with(emitter) {
      
delaymin 0.01;
      
delaymax 0.01;
      
nrofparticles 3;
      
emitautomatically false;
      
autorotation true;
      
firstinfront true;
      
emissionoffset = {
        
000
      
};
      
attachposition false;
      
checkbelowterrain false;
      
continueafterdestroy false;
      
maxparticles 100000;
      
particleTypes 1;
      
with(particles[0]) {
        
image "g4_animation_fire.gif";
        
zoom 0.25;
        
red 1;
        
green 1;
        
blue 1;
        
alpha 1;
        
mode 1;
        
lifetime 0.6;
        
angle degtorad(32);
        
zangle degtorad(0);
        
speed 30;
        
rotation degtorad(0);
        
spin degtorad(0);
        
partx 0;
        
party 0;
        
partw 0;
        
parth 0;
        
stretchx 1;
        
stretchy 1;
        
sound "none.wav";
        
layer 2;
      }
      
addlocalmodifier("once"00"angle""replace"degtorad(0), degtorad(360)); // Sparks
      
addlocalmodifier("range"0.250.5"alpha""replace"0.990); // SparkFadeOut
    
}
  }

Have fun ARC Welding pixels to other pixels!
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote