01: Custom Types Basics

"The Custom Type is the basis for Object-Based Programming in Blitz3D."

Custom Types can be used to create a single item or 'collection' of items that contains a set of variables. It's a programming structure used for grouping a set of variables under a single label. This is the basis for Applied Object-Based Programming with Blitz3D.

Type item
	Field a%
	Field b#
	Field c$
End Type

myitem.item = new item

myitem\a% = 1
myitem\b# = 2.5 
myitem\c$ = "Hello World"

It has been suggested to think of Custom Types as a set of records in a Database, hince the keyword 'FIELD' used to define them. I would encourage Blitz3D Programmers to also think of Custom Types in terms of Objects. Objects in which each variable is a property that defines the object.

When you create an object using the New Keyword in Blitz3D, you are creating an instance of the object.


  1. Create a object type named invader. Define 4 properties: id%, x#, y#, state%
  2. Create an invader new instance assigning it to myinvader.invader. Assign the values of: 16,32,1 to myinvader's properties: x#, y#, state% respectively.
  3. Print all myinvader's properties to screen.
  4. Delete myinvader.

Email-in this Exercise for Grade!