Why you should name types?

Blitz3D Forums/Blitz3D Beginners Area/Why you should name types?

the name isn't useless... try this

Graphics 640, 480, 0, 2

; Create a type, called "sprite" and assign some fields to it
Type SPRITE 
	Field LOCX 
	Field LOCY 
End Type 

zombie.sprite = New sprite 
zombie\LOCX = 55
zombie\LOCY = 55 

; Create 5 instances of the "sprite"-type, each one called "cats", and give the fields some values
For temp = 1 To 5 
	cats.sprite = New sprite 
	cats\LOCX = 1
	cats\LOCY = 1 
Next   

;Print Out all Sprites
For SomeRandomName.sprite= Each sprite 
	Print SomeRandomName\LOCY
Next 
      
;Empty Line
Print 

; Only change one instance of the cats (the one with the pointer)
cats\LOCX = 22
cats\LOCY = 22

;Print Out all Sprites
For SomeRandomName.sprite= Each sprite 
	Print SomeRandomName\LOCY
Next 

;Empty Line
Print 

; Change the zombie (it doesn't need the pointer, only one zombie exists
zombie\LOCX = 99
zombie\LOCY = 99

;Print Out all Sprites
For SomeRandomName.sprite= Each sprite 
	Print SomeRandomName\LOCY
Next 

While Not KeyHit(1)
Wend

End


it prints out:

55
1
1
1
1
1

55
1
1
1
1
22

99
1
1
1
1
22


names aren't useless... theire only used seldom if you use types only for a collection of objects of the same sort. If you need a special object names are very useful.