Types and DIM

Blitz3D Forums/Blitz3D Beginners Area/Types and DIM

Cold Harbour(Posted 2004) [#1]
Hi.

Any chance someone could post a small listing showing how to use arrays and types such as

Global mine.MyType Dim all_mine.MyType( 100 ) 


I've been trying to work this out for hours. I don't understand the difference between 'mine' and 'all_mine'. It's just not clicking.

Gahhh, it's all so confusing. Thanks a lot for any help!


Yan(Posted 2004) [#2]
Type fred
  Field ears
End Type

Dim bloke.fred(9)

For n=0 to 9
  bloke(n) = new fred
  bloke(n)\ears = Rand(4)
Next

show_fred()

Waitkey()

end


Function show_fred(); Arrays are global
  for n=0 to 9
    print "Fred now has " + bloke(n)\ears + " ears!"
  Next
End Function

YAN


Cold Harbour(Posted 2004) [#3]
Ah, got it.

It was that first bit in the user guide (Global mine.MyType) that was causing the problem.

Thanks a lot Yan!