Global TYPEs

Blitz3D Forums/Blitz3D Programming/Global TYPEs

Or the superior object/handle method:
TYPE Ship 
  Field X 
  Field Y 
END TYPE

Global ImAShip = CreateShip()
Global ImAnotherShip = CreateShip(5,2)

MoveShip(ImAShip,5,10)
MoveShip(ImAnotherShip,100,24006583)

Function CreateShip(x=0,y=0)
  Ship.Ship = New Ship
  Ship\x = x
  Ship\y = y 
  Return Handle(Ship)
End Function

Function MoveShip(n,movex,movey)
  Ship.Ship = Object.Ship(n)
  If Ship = Null Then Return False

  Ship\x = Ship\x + movex
  Ship\y = Ship\y + movey
End Function

Fredborg