Behavior Inheritance and derivative
by Eyaly · in Torque Game Builder · 07/15/2008 (3:21 am) · 2 replies
Hi
i wonder how can i derive/inherit behavior to a new behavior.
lets say i have 2 behaviors
one named B_SHOOT
and the second behavior named B_MOVE
now i want to create third behavior name: B_SHOOTWHILEMOVE
which derive from B_SHOOT and B_MOVE.
1. how to implement this?
2. does B_SHOOTWHILEMOVE will appear in TGB interface with B_MOVE and B_SHOOT attributes?
thanks
i wonder how can i derive/inherit behavior to a new behavior.
lets say i have 2 behaviors
one named B_SHOOT
and the second behavior named B_MOVE
now i want to create third behavior name: B_SHOOTWHILEMOVE
which derive from B_SHOOT and B_MOVE.
1. how to implement this?
2. does B_SHOOTWHILEMOVE will appear in TGB interface with B_MOVE and B_SHOOT attributes?
thanks
#2
08/17/2008 (6:02 am)
I know this is old but I just found it. I think the way to go with creation of game objects is composition as much as possible, and behaviors support this. Generally speaking, inheritance ties you into a hierarchy that can become difficult to manage, maintain and change at a later date. Behaviors naturally direct the developer towards using components for object creation.
Associate James Ford
Sickhead Games
But lets say you wanted to make a new behavior that contained some aspects of B_SHOOT, some of B_MOVE, and some of its own...
Well you could either decompose B_SHOOT and B_MOVE into smaller sub-behaviors so you can add only the parts you want to the object, or you could just copy and paste the parts you want into a new behavior.
I think option two makes more sense with behaviors as simple as these.