You can even make fields arrays of types! Very nice...
And normal blitz arrays ARE dynamic, you just redim them. But field arrays are not dynamic, and must have a known size at compile time. So
Will not work.
But
Will work since typesize is const, and is therefore known at compile time.
Const ASDNumAllowedCollisions = 20 Const ASDNumOffsetLayers = 10 Const ASDNumSprites = 100 Const ASDNumTexts = 10 Const ASDDebug = 1 ; 0 to remove debug messages ; 1 for debug messages Type AlmoSpriteDriver Field BackgroundImage ; Expects handle to be in upper-left corner Field BGOffsetLayer Field CLSEachFrame Field DefaultFont ; after calling ASDUpdate, this font will be the Text-ing font ; specify -1 (the default) and ASD will leave the Text-ing font the ; same as that of the last drawn Text. Field DrawBG Field OffsetLayers.ASDOffsetThing[ASDNumOffsetLayers] Field Sprites.ASDSprite[ASDNumSprites] Field Texts.ASDText[ASDNumTexts] Field Initialized End Type Type ASDOffsetThing Field x#, y# End Type Type ASDSprite Field Image Field x#, y# Field Active ; 0 - sprite is inactive, doesn't do anything ; 1 - sprite is active, draws, etc. Field Collides ; -1 - sprite doesn't collide ; 0 - sprite collides with all other sprites with Collides >= 0 ; >= 1 - sprite collides with all other sprites with same Collides value ; and those with Collides = 0 Field OffsetLayer Field Collided[ASDNumAllowedCollisions] ; max allowed collisions a sprite will store. ; subsequent collisions ignored Field NumCollisions ; indicates number of collisions this frame End Type Type ASDText Field theText$ Field x, y Field CenterX, CenterY Field OffsetLayer Field Active ; 0 or 1, whether to draw or not Field OnTop ; 0 or 1, whether it shows up on top of other sprites Field theColorR, theColorG, theColorB ; color of text Field Font End Type ; end typedefs
And normal blitz arrays ARE dynamic, you just redim them. But field arrays are not dynamic, and must have a known size at compile time. So
;BROKEN CODE global typesize = 20 type mytype field thefield[typesize] end type ;END BROKEN CODE
Will not work.
But
const typesize = 20 type mytype field thefield[typesize] end type
Will work since typesize is const, and is therefore known at compile time.