Game Development Community

Components in the Torque Combat Demo

by Shiraz · in Torque X 2D · 02/25/2007 (9:43 pm) · 6 replies

The Torque Combat demo doesn't have a componentSpecs.ed.cs file yet its components work. How's that possible?

#1
02/25/2007 (9:52 pm)
Components do not have to be added via TGBX. TorqueCombat adds them through code which I don't advise because it is very easy to run into problems that way. The componentSpecs.ed.cs file is only there for TGBX to parse and add anything in it to its functionality. On a side note you'll notice that it's written in TorqueScript and thus, not handled by the engine at all.
#2
02/25/2007 (10:03 pm)
Yeah, I just found the code...

PlayerCollisionComponent pcol = new PlayerCollisionComponent();
player.Components.AddComponent(pcol);

the weird thing is when I tried to create a componentSpecs.ed.cs to add my own components it wouldn't compile.
#3
02/25/2007 (10:05 pm)
Make sure in the properties panal that the build action is not set to compile. It will automatically be execed by TGBX.
#4
02/25/2007 (10:25 pm)
That got it! Thanks!
#5
02/27/2007 (12:02 am)
If I add the componentSpecs.ed.cs to my project will it just be recognized or do I have to set something? My program's not applying the components listed there.
#6
02/27/2007 (6:45 am)
Visual Studio doesn't do anything with componentSpecs.ed.cs. You don't even need to add it to your project if you don't want to, it just needs to be at the same level as your txproj file. When you open TGBX, it looks for the componentSpec file and loads from it directly. If you aren't seeing it, then you either have the file in the wrong location, it's named wrong, or you don't have that txproj loaded.

www.linkedin.com/img/webpromo/btn_viewmy_160x25.gif

www.mmogamedev.info/images/imgdc_ad1.gif