About types.... to...

Blitz3D Forums/Blitz3D Beginners Area/About types.... to...

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

A type is a structure from which you derive instances.

This is the structure:

type Player_typ
field X%
field Y%
field JumpHeight#
field Visible
end type

and this is an "instance" of the type, that you use in your game:

Global Player.Player_typ = New Player_typ
Player\X = 20
Player\Y = 20
Player\JumpHeight = 5.5
Player\Visible = false

The beauty of it is, you can make one or 1000's of instances from the same structure.

so:

for count = 1 to 1000
Player.Player_typ = New Player_typ
Player\X = 20
Player\Y = 20
Player\JumpHeight# = 5.5
Player\Visible = false
next

and you have 1000 instances of "Player" of type "Player_typ"