Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Minor Fix for Remote setting of x,y (https://forums.graalonline.com/forums/showthread.php?t=72772)

Novo 03-12-2007 04:28 AM

Minor Fix for Remote setting of x,y
 
PHP Code:

NPC A:

function 
onMoved( initx, inity, newx, newy )
  {
  
dx = newx - initx;
  
dy = newy - inity;
  for ( 
item: this.items )
    {
    
with ( item )
      {
      
this.x += dx;
      
this.y += dy;
      
this.trigger( "Moved","" );
      }
    }
  } 

PHP Code:

NPC 'item':
function 
onMoved()
  {
  
this.x = this.x;
  
this.y = this.y;
  } 


... Without this, when setting item.x += dx, the item position doesn't update. It only does when you actually set it this.x = this.x; in it's own script. Awkward character of GS2!

napo_p2p 03-12-2007 05:05 AM

I guess you can also pass dx and dy as parameters, then for onMoved for the item do: this.x += dx and this.y += dy.


All times are GMT +2. The time now is 06:57 AM.

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