Quote: "Is there a way to automatically allocate the id?"
yes. see
HERE.
so, you'd do something like:
SetErrorMode(2)
// set window properties
SetWindowTitle( "boxes" )
SetWindowSize( 1280,720, 0 )
// set display properties
SetVirtualResolution( 1280,720)
SetOrientationAllowed( 1, 1, 1, 1 )
SetSyncRate( 30, 0 )
SetScissor( 0,0,0,0 )
UseNewDefaultFonts( 1 )
GLOBAL Map as Integer [4,4]
for x = 0 to 4
for z = 0 to 4
ThisBox = CreateObjectBox(1,Random(1,3),1)
SetObjectPosition(ThisBox, x, 0, z)
SetObjectColor(ThisBox,Random(128,255), Random(128,255), Random(128,255), 255)
Map[x,z] = ThisBox
next z
next x
do
If GetRawKeyState(27) then Exit
if Last# + 0.1 < Timer()
SetObjectColor(Map[Random(0,4),Random(0,4)],Random(128,255), Random(128,255), Random(128,255), 255)
Last# = Timer()
Endif
Print( ScreenFPS() )
Sync()
loop
the idea is to let AppGameKit allocate the object IDs (my preference) but you'll need some way to reference those object IDs later.
so, if the boxes represent your map, make an array (ie, Map[4,4] ) for easy reference to those IDs.
if you want to change one of the boxes, say the box at 1,1 then the ID of that box would = Map[1,1]
this:
if Last# + 0.1 < Timer()
SetObjectColor(Map[Random(0,4),Random(0,4)],Random(128,255), Random(128,255), Random(128,255), 255)
Last# = Timer()
Endif
...finds the object id at a random location in the Map and changes its color, for example.
otherwise, do yourself a
big favor and skim through the
guides and the rest of the
help files