Game Development Community

Spawn a mounted object

by Niklas Karlzén · in Torque Game Engine · 02/04/2010 (5:00 pm) · 1 replies

How can I make a mounted object spawn, at the same time as the object it´s mounted too spawns? So if i have an object that moves from right to left, in a sine-wave movement, which spawns on collision with the left world limit. How do i make an other object mounted to that one, actually spawn, instead of sliding back across the screen?

( Im very new to programming, as you probably already have guessed by now, hehe =P )

About the author

Recent Threads


#1
02/04/2010 (8:45 pm)
If you want a new, mountable object to appear right with another object, for example, spawn a sword in the player's hand every time they spawn, I would suggest the onAdd methods. so some psuedo-code for that would be...

[code]
function MyPlayerClass::onAdd(%this) // The args might have to be %this, %obj in some cases
{
%sword = new ShapeBaseImage() //The object being created
{
datablock = SweetSword;
};

%this.mountImage(%sword,0); //Would be different if the object was not an image
}
[code]

[quote]
So if i have an object that moves from right to left, in a sine-wave movement, which spawns on collision with the left world limit. How do i make an other object mounted to that one, actually spawn, instead of sliding back across the screen?
[quote]

I did not truly understand what you were trying to say.