Game Development Community

a trigger as a behaviorField of an owner.

by rennie moffat · in Torque Game Builder · 07/30/2010 (2:23 pm) · 0 replies

Hi I am trying to set up a triggerObject as part of a behavior, which turns an enemyObject on and off like a light switch. I have already made one with behaviors where a completly separarte behavior handles the "enabler", setting a global true if collided with by player. However, since I have multiple enemyObjects of the same calss, I think it might be best if each enemy has it's own trigger. As such, I am trying to give an enablerObject to each enemy with in it's native behavior, however I am having trouble with it.



Currently I have...

1. behaviorField(object, enablerOn)
2. behaviorField(object, enablerOff)
3. onCollision (and this is where it gets tricky for me as the collision is not only supposed to handle when the enablerObject is collided with, but also when the actual owner is collided with to handle a completely different set of instructions.

function bigBlueBehavior::onCollision(%srcObject, %dstObject, %srcRef, %dstRef, %time, %normal, %contacts, %points)
{
	if(%dstObject.class $= "playerClass")
	%srcObject.setTimer();
///currently I have only this... however I think I should have a separate command for the each enabler and one for the owner
}

So if %dstObejct $= "playerClass";
//// and here is where I get confused. How can I, with in a behavior, tell if it is the owner, or an owner's object that has been collided with?

About the author

My thanks to Garage Games and the Garage Games Community combined with owned determination I got one game up, Temple Racer and I am looking to build more interesting, fun games for the mass market of the iOS app store.