Moving a object back after using SetForwardSpeed
by \"Robert Jaramillo\" · in Torque Game Builder · 02/19/2010 (12:28 pm) · 7 replies
Hello, Everyone
I am curious if there is a way to move an object back using setFrowardspeed() function? If not, I could use your guy's help when it comes to figuring out how to do this. Below is the function that I am using. Please any help would be greatly appreciated.
function Harpoon::Retract(%this, %points)
{
if(%this.getPosition() == $PlayerCenter)
{
$Player.InceraseScore(%points);
%this.bIsReadyToFIre = true;
return;
}
else
{
//check if we have been in this function before
if(%this.getForwardMovementOnly() == true)
{
%this.SetForwardMovementOnly(false);
%this.setForwardSpeed(-20);
}
//%this.schedule(17, "Retract", %points);
}
return;
}
I am curious if there is a way to move an object back using setFrowardspeed() function? If not, I could use your guy's help when it comes to figuring out how to do this. Below is the function that I am using. Please any help would be greatly appreciated.
function Harpoon::Retract(%this, %points)
{
if(%this.getPosition() == $PlayerCenter)
{
$Player.InceraseScore(%points);
%this.bIsReadyToFIre = true;
return;
}
else
{
//check if we have been in this function before
if(%this.getForwardMovementOnly() == true)
{
%this.SetForwardMovementOnly(false);
%this.setForwardSpeed(-20);
}
//%this.schedule(17, "Retract", %points);
}
return;
}
#6
Seriously, though, it's very poor form to post over and over. Some questions don't get answered for 24-72 hours after they are posted. I think it's reasonable to wait at least 24 before bumping your question up again and again.
02/19/2010 (4:09 pm)
No, no, no, and no.Seriously, though, it's very poor form to post over and over. Some questions don't get answered for 24-72 hours after they are posted. I think it's reasonable to wait at least 24 before bumping your question up again and again.
#7
02/19/2010 (4:34 pm)
Robert, for rotation based movement, have a look at the setLinearVelocityPolar or setImpulseForcePolar functions.
Torque Owner Mike Lilligreen
T2DTutorials
If you want to move an object along the Y axis for example, use setLinearVelocityY(20) and then to reverse it's direction and move it back use setLinearVelocityY(-20).