Game Development Community

Key can only be bound to one object

by Greg Squire · in Torque Game Builder · 05/23/2007 (10:00 pm) · 1 replies

I've been playing with 1.5 beta 3 some and it appears that I only bind a key to only one object. For example in the BehaviorPlayground project if I set the "shoot" behavior on both the tank and asteriods ship to respond to the "space" key, then nothing happens to either object. However if only one of them is set to the "space" key then it works. There might be times when you want more than one object to listen to the same key, such as a shooter that has helper ships attached to it, or maybe in a bugs game that causes them to scatter when you turn on a flashlight with a keystroke, etc.

Anyway, is this a limitation of the engine or is this a bug? If it's a limitation, how would you get around it? Have an object that responds to the key and then created another custom event that the other objects listen to?

#1
05/23/2007 (10:32 pm)
Well usually you would have one binding function that could forward it to whatever needs to be done, so no limitation there in the general sense, although I can see how one might want different behaviors to all listen to for the event. In that case I would assign the bind to call a method on the owner (as methods are forwarded from the owner to all behaviors attached to it) and have a method in each behavior with the same name.