Torque2D, Class vs Datablock

Posted by Max Kielland on Game Development See other posts from Game Development or by Max Kielland
Published on 2012-11-04T13:37:40Z Indexed on 2012/11/04 17:17 UTC
Read the original article Hit count: 346

I'm scripting my first game with Torque2D and have not fully understood the difference between "Class" and Datablock.

To me it seems like Datablock is similar to a struct in C/C++ or a Record in Pascal. If I create Datablocks with new, are they instantiated in the same way as a "Class"?

I have a large TileMap and need to attach some information to each Tile. I was thinking to use a Datablock, as a struct, to attach this information to the tile's CustomData property.

The two questions are: What is a Datablock and should I use a Datablock or a "Class" for this tile information?

© Game Development or respective owner

Related posts about tilemap

Related posts about data-structure