Game Development Community

Is there a way...?

by Robert Carroll · in Torque Game Builder · 10/07/2009 (12:53 am) · 3 replies

I was wondering if theres a way to mount an oject while in a game... say as in dragging an object then puting it on another? And having it stay there?

#1
10/07/2009 (2:50 am)
yes... its posible.

1st, you need to have the mouse interaction ON on the object you wanna mount (source) and the object you wanna mount the other object to (destination)... if thats enabled, all you need to do in your code logic is:

1) detect when the source has been clicked.
1.1) if you want you drag it to the destination, an easy (and cheap way) to do it, is to make that object follow the mouse cursor
2) detect when the destination object has been clicked

when that is done, all you have to do is invoke the "mount" command with the respective parameters, and you're all set.

it may take you some tweaking here and there, but again, its possible.

PS: sorry if i dont post no snippets... but if you know what i just talked about, you should create your own snippet in no time. if not... its possible that someone else will take the time and create a snippet for you.
#2
10/07/2009 (3:16 am)
OK, Thanks I didn't get what exactly what you ment but you inspired me to ask another question. Im a n00b btw, would there be a way to make an object stay in one spot until clicked on then, follow an object when clicked on? Maybe by world limits?
#3
10/07/2009 (3:21 am)
Im cheating my way through TGB for now, like cheap behaviors, spawners that make spawners for increassing difficulty. Im making a game that is like a platformer but the charecter has guns, im making the gun follow the person and hopefully I can make a gun that cancels out another gun. Bit confuseing but hope it works. ^My person is my profile^ Made with powerpoint XD true indie :)