Game Development Community

Setting className in datablock

by Konrad Carstein · in Torque Game Builder · 06/29/2008 (11:43 am) · 3 replies

I'm trying to clean up some of the code I've been hacking together over the last week and am trying to move more data into datablocks. I'm having problems defining a class though in a datablock.


datablock t2dSceneObjectDatablock(enemy){
   health = 50;
   dmg = 100;
   className = EnemyClass;
   size = "9 8";
};

This does not seem to work. Unless I specify "EnemyClass" as the class in the level editor, the object does not respond as it should. What did I do wrong here?

Also, is there a reference that provides all the values you can specify in the datablock as they relate to the level editor? I'd like to put all my collision and physics settings into the datablock, so I can quickly add objects to a scene, specify their datablock and be done with it.

Thanks!

#1
06/29/2008 (11:54 am)
The field for classes is just "class" instead of "className". You could also define "superclass" which is like the class of classes. That's why its super. ; )

Look at the TGB Reference doc bundled with TGB to find the fields you can define. Remember that all inherited fields can be used too. All t2dStaticSprites can define t2dSceneObject fields, etc.
#2
06/29/2008 (12:17 pm)
I must be losing my mind. I swear I tried that, in fact started with that. Then did some searching and found the "className" being used. Went back to "class" and it works.

Thanks.
#3
06/29/2008 (12:24 pm)
Don't worry, I thought I was going insane with that whole collision physics issue.

It happens. :)