Oh, that was a bad one!
In function CreateGameObject: ...
FUNCTION CreateGameObject: iNewType, iX, iY, iXDir,iYDir
LOCAL pNew AS TGAMEOBJECT
...
RETURN pNew
ENDFUNCTION
See the mistake? You return a TYPE in a function returning a numnber. Thus:
FUNCTION CreateGameObject AS TGAMEOBJECT: iNewType, iX, iY, iXDir,iYDir
should work.
...and i does! Yay!
I try making this error more obvious in a new version.