Thread: onwater()
View Single Post
  #8  
Old 06-04-2010, 11:44 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Have you considered using the built-in move? I know this probably doesn't fix your current problem but just something that could benefit you down the line.

Here's a little example of what's possible:

PHP Code:
//#CLIENTSIDE

function onCreated() {
  
showcharacter();
  
setTimer(0.05);
}

function 
onTimeout() {
  
// Move to a random location in 2 seconds.
  
moveTo(random(0, 64), random(0, 64), 2);
  
// Wait till movement complete
  
waitfor(this, "MovementFinished");
  
// Continue looping
  
setTimer(0.05);
}

function 
moveTo(tx, ty, time) {
  
// Determine Movement Deltas (Final take away Initial)
  
temp.dx = tx - this.x;
  
temp.dy = ty - this.y;
  
// Set New Direction
  
this.dir = getdir((this.x + dx) - this.x,(this.y + dy) - this.y);
  
// Set Movement Animation
  
setcharani("walk", "");
  
// Move (The 8 at the end is so the MovementFinished event is called)
  
move(temp.dx, temp.dy, time, 8);
}

function 
onMovementFinished() {
  
setcharani("idle", "");
} 
__________________
Quote:
Reply With Quote