BrightSign BrightScript 3.0 Reference Manual User Manual
Page 65

60
REM *******************************************************
REM *************** *********************
REM *************** GAME BOARD OBJECT *********************
REM *************** *********************
REM *******************************************************
REM *******************************************************
REM
REM An example BrightScript constructor. "newGameBoard()" is regular Function of module scope
REM BrightScript Objects are "dynamic" and created at runtime. They have no "class".
REM The object container is a BrightScript Component of type roAssocitiveArray (AA).
REM The AA is used to hold member data and member functions.
REM
Function
newGameBoard()
As
Object
game_board=CreateObject(
"roAssociativeArray"
)
' Create a BrightScript Component of type/class roAssociativeArray
game_board.Init=gbInit
' Add an entry to the AA of type roFunction with value gbDraw (a sub defined in this
module)
game_board.Draw=gbDraw
game_board.SetSnake=gbSetSnake
game_board.EventLoop=gbEventLoop
game_board.GameOver=gbGameOver
game_board.StartX=gbStartX
game_board.StartY=gbStartY
game_board.Init()
' Call the Init member function (which is gbInit)
return
game_board