Game Development Community

Fish Tut Miss Typo

by Sventhors · in Torque Game Builder · 02/24/2007 (9:02 am) · 1 replies

I was wondering if there is miss typo in Fish tutorial, in the directions.
or do we have to figure it out. I figured it out. yeah:) By going to the
next section of tutrioals.


In the 6.1 Come in at a Random Position.

In the directions it says this.

Quote:We need to add a call to both the "left" and "right" responses. This call will set the fish's Y position in a random number between the top of the level and just above the ground. Make your function look like this.

function FishClass::onWorldLimit(%this, %mode, %limit)
{
   switch$ (%limit)
   {    
      case "left":
         %this.setLinearVelocityX(20);
         %this.setFlipX(false);
      case "right":
         %this.setLinearVelocityX(-20);
         %this.setFlipX(true);
    }
}


should the code say(was this left out %this.setPositionY(getRandom(-35, 25));):
function FishClass::onWorldLimit(%this, %mode, %limit)
{
   switch$ (%limit)
   {
      case "left":
         %this.setLinearVelocityX(20);
         %this.setFlipX(false);
         %this.setPositionY(getRandom(-35, 25));//was this left out?
      
      case "right":
         %this.setLinearVelocityX(-20);
         %this.setFlipX(true);
         %this.setPositionY(getRandom(-35, 25));//was this left out?

        
      
   }
}

sorry for bad english, english not first lanugage