Another question:)
Can the foreach command be used on a multidimensional array.I have tried using the following code but it only shows one line
// Project: alpha
// Start: Sunday, July 22, 2007
// IDE Version: 4.237
LOADSPRITE "red.png", 1
LOADSPRITE "green.png", 2
LOADBMP "background.png"
TYPE ball
x
y
colour
ENDTYPE
GLOBAL balls[] AS ball
DIM balls[9][9]
FOR y=0 TO 8
FOR x=0 TO 8
balls
balls
balls
NEXT
NEXT
WHILE TRUE
ALPHAMODE -1
foreach item in balls[]
xx=item.x
yy=item.y
col=item.colour
sprite col,xx,yy
next
SHOWSCREEN
WEND
No. It only acts on the first array index. Multidimensional arrays will return the first item
No problem Gernot.I will just use a nested for next loop instead.Thanks for the quick reply.