Type Question

Blitz3D Forums/Blitz3D Beginners Area/Type Question

Crazy4Code(Posted 2006) [#1]
I've used Types before, but I've never really tried to understand what's happening. It seems that once you define a Type, and create a new object out of it, it's placed into a global "stack" like structure. From there that stack can be cycled through. So now to the question.

Is there a way to split that stack into two parts? Like, blocks in the "well" for Tetris, and blocks for the falling shape?

EDIT: Or better yet, is there a way to have an array of types?


GfK(Posted 2006) [#2]
The only way is to use a field within your type to determine what the object is. Either that or have two separate types.


Crazy4Code(Posted 2006) [#3]
Okay, thanks


Buggy(Posted 2006) [#4]
Yes, there is a way to have an array of types. I'm not quite sure how to do it, but I remember in Krylar's book about BlitzBasic, it demonstrated how to do arrays of types, arrays within types, and types within types!


Stevie G(Posted 2006) [#5]
Array of types ..

Type MyType
   field x#, y#, z#
end type

Dim MyArray.MyType( 1, 10 )

MyArray( 0, 0 ) = new MyType
MyArray( 0, 0 )\x = 10


etc....

Stevie


Crazy4Code(Posted 2006) [#6]
Aha! Thanks!