Is it possible to add new methods to raw t2dSceneObject class?
by Mirko Topalski · in Torque Game Builder · 07/03/2009 (7:51 am) · 4 replies
Is it possible to add new methods to raw t2dSceneObject class?
Since i have "actors" superClass for all moving (live) actors in my game (player and enemies) i get into a problem: I cant set the same class (or superClass) to any t2dStaticSprite and then to some t2dAnimatedSprite. Since my player model is animated, and all others are static...
So i was wondering if i can set some universal methods for all t2dSceneObjects somehow?
Since i have "actors" superClass for all moving (live) actors in my game (player and enemies) i get into a problem: I cant set the same class (or superClass) to any t2dStaticSprite and then to some t2dAnimatedSprite. Since my player model is animated, and all others are static...
So i was wondering if i can set some universal methods for all t2dSceneObjects somehow?
#2
function t2dSceneObject::newMethod(){
}?
(i am not currently at some office computer, so i can't test this until tomorrow)
07/03/2009 (8:38 am)
You mean, i just type function t2dSceneObject::newMethod(){
}?
(i am not currently at some office computer, so i can't test this until tomorrow)
#3
07/03/2009 (8:39 am)
Oh this is in script! I'm not familiar with script OOP I'm afraid.
#4
07/03/2009 (3:28 pm)
It turns out that YOU ACTUALLY CAN just simply define a method for ANY t2dSceneObject from script with that simple code lines:function t2dSceneObject::newMethod(){
// any statements
}So technically, this way you can define new methods for ANY non-virtual OBJECT IN THE GAME! Now i have extra superSuperClass, AWESOME :D
Associate Ian Omroth Hardingham