PDA

View Full Version : Array


matteo.m
10-15-2006, 01:56 PM
I'm wondering if it's possible to create an array of struct... something like:
#define TbSpr ("col", "posx", "posy")
struct (Tbsprites$, TbSpr);
Dim(Tbsprites$,60);
Tbsprites.col[0] = red;
............

kornalius
10-15-2006, 03:39 PM
Yes use the following:

struct (a$, "x", "y");
TDIM(a$, 10);

a.x$[5] = 10;
a.y$[5] = 10;

matteo.m
10-15-2006, 05:11 PM
thanks Kornalius

kornalius
10-15-2006, 09:02 PM
You are welcome.

matteo.m
10-26-2006, 04:10 PM
can i make the array of struct global?

kornalius
10-26-2006, 06:29 PM
Yes you can.

matteo.m
10-26-2006, 06:42 PM
something like this:

#define TbSpr ("col", "posx", "posy", "stato","id")
struct(spr$, TSprite);
struct (Tbsprites$, TbSpr);
TDim(Tbsprites$,60);
global(Tbsprites$);
Tbsprites.posx$[10]= 50;


will be Tbsprites.posx$[] a global array too?