There is at least one problem with this code:
For t = 0 To 32
grid[t,i] = x
For i = last To count
grid[t, i] = y
Inc y, 32
If y > 768 Then y = 0
Next i
Inc last, 23
Inc count, 23
Inc x, 32
Next t
You are assigning a value "grid[t,i] = x" outside of the loop that you define 'i' in. The first iteration through the 'For t' loop will have 'i' at zero (first use of undefined variable in AppGameKit is always zero). After that it will be set to count + 1, the value it was at when the 'For i' loop finishes. And the first line in your 'For t' loop is wiping out that x value.
And I really don't understand what you are trying to do. If you are trying to store the y value in the grid, there is no need to slide the second index, your 'i', the way you are doing.
I do know that the DrawLine function does not draw a point if the start and stop positions are the same. This was discovered by someone else in some other thread.
Try this (it creates a grid of dots and the file has the correct values):
Rem Sets up array for storing data
rem set the display
SetVirtualResolution(1024,768)
rem a type to hold the position
type tXY
x as float
y as float
endtype
rem the array to hold the grid of positions
Dim grid[32,23] as tXY
rem set the initial x & y positions
x# = 0
y# = 0
For t = 0 To 32
For i = 0 To 23
rem store the values
grid[t,i].x = x#
grid[t,i].y = y#
rem update the y (using inc actually messes this up and it shouldn't)
y# = y# + 32
If y# > 768 Then y# = 0
Next i
rem update the x (same issue with inc)
x# = x# + 32
Next t
OpenToWrite(1, "griddata.txt", 0)
For t = 0 To 32
For i = 0 To 23
x# = grid[t,i].x
y# = grid[t,i].y
WriteLine(1, "T = " + STR(t) + ", I = " + STR(i) + ", Grid = " + STR(x#) + " x " + STR(y#))
Next i
Next t
CloseFile(1)
Do
if GetPointerPressed() then end
For t = 0 To 32
For i = 0 To 23
x# = grid[t,i].x
y# = grid[t,i].y
Dot(x#, y#, 255)
Next i
Next t
Sync()
Loop
Function Dot(x as float, y as float, c as integer)
DrawLine( x, y, x+1, y+1, c, c, c )
EndFunction
Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master