2 Small questions

Blitz3D Forums/Blitz3D Beginners Area/2 Small questions

Hi, just 2 things I need clarifying

1) Are all Types global, and if not can I make them so the same way as variables?

2) Is it possible to store Arrays within Types?

1) Types are not automatically global but you can make them global
e.g global enemy.bullet
2) Yep, but they're 'special' Blitz arrays.
Type ship
Field missiles[2]
They have a few limitations...
http://www.blitzcoder.com/cgi-bin/code/code_showentry.pl?id=thechange09052002191420&comments=no
You can also have types within types and arrays of types.
Blitzcoder has some articles and Learn to Program 2D Games in Blitzbasic has a good section on this subject.

Thanks

so I should be setting the individul type elements as Global instead of the type itself?

so I should be setting the individul type elements as Global instead of the type itself?


Generally, they're referred to as instances. If by elements, you mean instances, yes.

EG:

Type Ball
  Field X#,Y#,Z#
End Type

Global BasketBall.Ball=New Ball


In the example, Ball is the type, and basketball is an "instance" of the type. Types are automatically global, and you can create, delete or reference new or old instances in any function or from the main body of your program. Instances are only global if you specifically declare them so, as Tony demonstrated.

got it

thanks for the help

Blitz has a lot of new stuff in it for me, its much better than slow old Dark Basic

Cool thought I would say hi as you are new, hope you enjoy your self! I would awnser your quesiton but thats be done, ok what to do now I know (posts)