Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Shattering effect (https://forums.graalonline.com/forums/showthread.php?t=69634)

Yen 10-24-2006 07:48 PM

Shattering effect
 
I'm really fond of this effect. I like it a lot.

Why don't I use getimgwidth/height()?
If the image isn't loaded into memory, it returns no value. I'm setting constants to the height and width, so the effect will still display even if the image hasn't been loaded yet.

PHP Code:

function onPlayerEnters() {
  
this.psize 4// Number of columns and rows of particles to be used (x^2 is the total number of particles)
  
this.imgw 32// Width of the image being used
  
this.imgh 32// Height of the image being used
  
this.useimg "block.png"// Image to be used
  
hideimgs(50,50+this.psize^2);
  
showimg(50,this.useimg,1.5 - (this.imgw/16) / 21.5 - (this.imgh/16) / 2);
  
InitChips();
  
setTimer(.2);
}

function 
InitChips() {
  
this.cx = new[this.psize^2];
  
this.cy = new[this.psize^2];
  
this.ca = new[this.psize^2];
  
this.cs = new[this.psize^2];
  
this.cs2 = new[this.psize^2];
  
this.cr = new[this.psize^2];
  
this.cm = new[this.psize^2];
  for (
0this.psize^2a++) {
    
this.cx[a] = ((this.imgw/this.psize) * (a%this.psize)) / 16;
    
this.cy[a] = (int(this.imgh/this.psize) * int(a/this.psize)) / 16;
    
this.ca[a] = random(0,pi*2);
    
this.cs[a] = this.cs2[a] = random(.3,.6);
    
this.cr[a] = 0;
    
this.cm[a] = int(random(0,2));
  }
}

function 
onTimeout() {
  for (
0this.psize^2b++) {
    if (
this.cy[b] > 3.5) {
      
hideimg(50+b);
      continue;
    }
    
showimg(50+b,this.useimg,(player.1.5 - (this.imgw/16)/2) + this.cx[b],(player.1.5 - (this.imgh/16)/2) + this.cy[b]);
    
changeimgpart(50+b, (this.imgw/this.psize) * (b%this.psize), int(this.imgh/this.psize) * int(b/this.psize), (this.imgw/this.psize), (this.imgh/this.psize));
    
findimg(50+b).rotation this.cr[b];
    
this.cr[b] += random(pi/8,pi/12);
    
this.cs2[b] -= .1;
    
this.cy[b] -= this.cs2[b];
    
this.cx[b] += cos(this.ca[b]) * (this.cs[b] / 3);
    if (
this.cy[b] > 3.5hideimg(50+b);
  }
  
setTimer(.05);



xAndrewx 10-24-2006 08:32 PM

lmao, cool =D

smirt362 10-24-2006 08:54 PM

Could you give us a screenshot? I'm interested to know what it looks like.

Yen 10-24-2006 08:55 PM

You can't really screenshot an effect that moves, like this. :(

Log on Zodiac and ask a level 20+ Ninja to use 'Seal of Water' on you.


All times are GMT +2. The time now is 09:14 AM.

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