Game Development Community

T2DTileObject and components

by Doug Barnes · in Torque X 2D · 12/04/2007 (1:04 pm) · 1 replies

Hey everybody,

Was just wondering if its possible to add components to individual tiles in a tile map? and if not how difficult would it be to change the engine so that tiles could have components?

Thanks in advance,
Doug



Never mind I got it working. If anyone is wondering how to do it, is very easy all you need to do is change this "public class T2DTileObject : ICloneable" to this "public class T2DTileObject : T2DSceneObject,ICloneable" the line of code is located in T2DTileLayer.cs line 109.

#1
12/04/2007 (1:24 pm)
I've worked a lot with Tilemaps, but haven't tried this. As far as I can tell from the API, you can not attach components to individual tiles, but you can set an object type. You can attache components to the whole Tilemap, though.

Maybe you can work these two points together. For example, attach your components to the entire Tilemap, then the component's ProcessTick() method cycles through each cell (column,row) and then test each object type to perform the funciton you want.

Otherwise it's probably going to be a Torque X Framework code change, requiring the Pro license and a posting into the Private forums.

Hope that helps,

John K.