Game Development Community

Is it possible to define classes?

by Matthew Beyer · in Torque Game Engine · 07/08/2007 (12:12 am) · 1 replies

I've been playing around with Torque Script and while the functionality seems to be there, I can't for the life of me figure out how to define a class. Is it possible?

By class I mean 'variables within variables'

class car might contain
car.make
car.model
car.color
etc.

I've tried just using them as they are (%car.color = "red", etc.) but while it doesn't throw an error, the script doesn't perform the assignment. %car.color still equals null.

About the author


#1
07/09/2007 (8:24 am)
%car = new ScriptObject(ACar);
%car.color = "red";
%car.make = "Pontiac";
...
Basically, use a ScriptObject, then you can make up whatever fields you want on the spot and put whatever you want in them.