Creating a list in a type (OOP)

BlitzMax Forums/BlitzMax Beginners Area/Creating a list in a type (OOP)

Type alien
  Field x,y
  Global alienList:TList

  Function Create()
    If alienList=Null Then alienList=CreateList()
    a:alien=New alien
    alienList.AddLast(a)
    a.x=Rand(0,640)
    a.y=Rand(0,480)
    Return a
  End Function
End Type

Basically, have the global within the Type and check whether it's null or not when creating a new type.