View Single Post
  #19  
Old 12-14-2008, 02:56 PM
Pelikano Pelikano is offline
Registered User
Pelikano's Avatar
Join Date: Oct 2008
Posts: 1,133
Pelikano has a little shameless behaviour in the past
Ok another thing.
I decided to move the projectile serverside, because I was told that I had to do it like that, so it looks somewhat like this:

PHP Code:
function onCreated() {
  
setimg("shuriken_icon.gif");
  
setshape(1,12,12);
  
this.dird player.dir;
  
this.spread random(-client.spread,client.spread);
  
dontblock();
  
scheduleevent(3,"StarDestroy","");
  
setTimer(0.1);
}
function 
onTimeOut() {
  if (!
onwall(this.6/16 vecx(this.dir)*7/16this.6/16 vecy(this.dir)*7/16)) { 
    
this.+= vecx(this.dird) + (player.dir in {02} ? this.spread/16 0);
    
this.+= vecy(this.dird) + (player.dir in {13} ? this.spread/16 0);
    
setTimer(0.1);
  }
  
triggeraction(this.6/16 vecx(this.dir)*8/16,this.6/16 vecy(this.dir)*8/16,"StarDamage",nil);

Well, it does not work at all anymore!
The projectile gets spawned in front of my player, yes, but it doesn't move anymore.
While debugging I figured out that "this.spread" and "this.dird" are both 0 now and won't get set to what I want them to get set oO

x_X
Anyone?
Reply With Quote