Game Development Community

Recursive Scheduling Issue

by Doug Linley · in Torque Game Builder · 04/19/2006 (7:13 pm) · 1 replies

I've trying to animate two gems swapping places with each other, so I have a function that schedules itself to run every 1 second. The problem is that when it goes to run the schedule for the first time, I get a ": Unknown Command" in the console. Can anyone tell me how I should be properly calling this? Thanks!

function gridObj::moveTiles(%this)
{
   echo("in moveTiles" @ %this.direction);
   
   
   if(%this.direction == $right)
   {
      if(%this.object0.getPositionX() < %this.newTile1PositionX)
      {
         %this.object0.setLinearVelocityX(20);
         %this.object1.setLinearVelocityX(-20);
         echo("scheduling moveTiles");
         schedule(1000, 0, %this.moveTiles);         
      }
      else
      {
         %this.object0.setLinearVelocityX(0);
         %this.object1.setLinearVelocityX(0);
      }
   }
}

#1
04/19/2006 (7:33 pm)
Nevermind. I figured it out. I should have called it this way:

%this.schedule(1000, moveTiles);