Mounting
by Danny Mejia · in Torque Game Builder · 08/23/2006 (1:21 pm) · 6 replies
I have in object mount to in other object. When the player click on the object I want to dismount and re-mount to in other objects.
Here is what I have so far:
function ball::onRightMouseDown(%this, %modifier, %worldPosition, %mouseClicks)
{
%this.dismount();
%this.setPositionY(t2dVectorDistance(pad1.getPositionY()+12,pad2.getPositionY()+12));
%this.mount(pad,0,0,0,false,false,false,true);
}
I can get the object to dismount and move to the right position but it dose not re-mount. Could someone help me on this.
Thanks
Here is what I have so far:
function ball::onRightMouseDown(%this, %modifier, %worldPosition, %mouseClicks)
{
%this.dismount();
%this.setPositionY(t2dVectorDistance(pad1.getPositionY()+12,pad2.getPositionY()+12));
%this.mount(pad,0,0,0,false,false,false,true);
}
I can get the object to dismount and move to the right position but it dose not re-mount. Could someone help me on this.
Thanks
About the author
#2
08/23/2006 (6:53 pm)
Its a object.
#3
pad1 and pad2 are referenced previously in your code -- is your expectation to move the ball from pad1 or pad2 to pad -- or was the pad code a typo?
08/23/2006 (6:55 pm)
Danny,pad1 and pad2 are referenced previously in your code -- is your expectation to move the ball from pad1 or pad2 to pad -- or was the pad code a typo?
#4
08/23/2006 (6:56 pm)
Thanks all I had to do was change pad to pad2.
#5
Lets I have 20 pads on screen if there any way to see if two pad are face each other without use their references names. I thought I could could put all the pad x,y positions into in array.
08/24/2006 (5:37 am)
Pad1 and pad2 are referencec objects. I got it to move from pad1 to pad2 but know it move to fast.Lets I have 20 pads on screen if there any way to see if two pad are face each other without use their references names. I thought I could could put all the pad x,y positions into in array.
#6
You could store all the pad's X/Y coordinates in an array $pads[0] is the first pad, and you store the return of $pad1.getPosition() there, etc, etc ...
alternatively, you could have something like;
This would allow you to do:
To retrieve the X/Y of the first pad, for example
not requiring a $pad1, $pad2, $pad3, etc variable setup ... and allows you to easily add/remove pads to increase/decrease level complexity, depending on the game's overall concept
08/26/2006 (5:56 pm)
Danny,You could store all the pad's X/Y coordinates in an array $pads[0] is the first pad, and you store the return of $pad1.getPosition() there, etc, etc ...
alternatively, you could have something like;
$PAD_COUNT = 0;
function pad::onLevelLoaded(%this, %scenegraph)
{
$pads[$PAD_COUNT] = %this;
$PAD_COUNT++;
}This would allow you to do:
$pads[0].getPosition();
To retrieve the X/Y of the first pad, for example
not requiring a $pad1, $pad2, $pad3, etc variable setup ... and allows you to easily add/remove pads to increase/decrease level complexity, depending on the game's overall concept
Associate David Higgins
DPHCoders.com
Also, I believe you meant pad1 or pad2 perhaps?