I am doing this small study on data arrays. I ran into a problem with the _lenght constant of the read-only data. My data has 12 elements and it's not returning this value. Here's the code:
dim pixelPointer = a dim pixelTimer = b dim pixelX = c dim pixelY = d pixelPointer = $ff COLUPF = $40 COLUBK = $00 scorecolor = $40 MainLoop pixelTimer = pixelTimer + 1 if pixelTimer = 50 then pixelTimer = 0 : gosub pixelLocation pfpixel pixelX pixelY on rem ******************************************************************** rem TESTING VARIABLES f = pixelData_length score = 0 temp5 = f if temp5 > 0 then for temp6 = 1 to temp5 : score = score + 1000 : next temp5 = pixelY if temp5 > 0 then for temp6 = 1 to temp5 : score = score + 1 : next drawscreen goto MainLoop pixelLocation pfpixel pixelX pixelY off pixelPointer = pixelPointer + 1 : if pixelPointer = 12 then pixelPointer = 0 pixelX = pixelData[pixelPointer] pixelPointer = pixelPointer + 1 pixelY = pixelData[pixelPointer] return data pixelData 1,1,2,2,3,3,4,4,5,5,6,6 end
Actually, when I test this:
f = pixelData_length score = 0 temp5 = f if temp5 > 0 then for temp6 = 1 to temp5 : score = score + 1000 : next
...the playfield even changes color and the score shows 140.
So I had to hand code the value to avoid the pointers going beyond the number of elements...
if pixelPointer = 12 then pixelPointer = 0
Any help would be great! Thanks!















