Torque datablock equivalent?

BlitzMax Forums/BlitzMax Beginners Area/Torque datablock equivalent?

Hi Amaranth
Nice to see you over here :)


What you are looking for does not exist in that way in BM.
There is nothing that defines an "arbitary" object like a sprite or the like as BM only has a 2D through 3D based drawing system as a module to its programming and no 2d engine on top of it like TGB.
Nor does most of the other things you are used to exist unless you implement it in your own 2D engine.

The only thing that is even slightly similar to Datablocks are Types.
To replicate the behavior of your part above, you would have:

' Item
Type TItemDatablock

 field Class:String = "Item"
 field Layer:int = 18
 field UseMouseEvents:int = true
 field Size:float[] = [5 5]
end type


' Grain
type Ti0Datablock extends TItemDatablock

 field type:int = 0
 field attack:int = 0
 field price:float = 2
end type

Local Grain = Ti0Datablock  


If you want the datablock based approach with "dynamic classes" this will be a fair amount of work. There is no such mechanism or system available.
Above shows you thought how to work with the classes directly.
You can still create Template Classes (like the datablocks in TGB) and implement functionality into them ( methods ).

What you do in BM is the same what Torque does on the C++ side ...

PS: How did your teams last game work out? :)