On Apr 19, 4:05*am, Mike <michael.sg...@gmail.com> wrote:
> Hi
> * *below how/where do i initialize the array? *pos[4][4] = { x,y };
> How can I then access and write to positions within the array?
> Many thanks
> Michael
> ---------
> * * class droplet
> * * {
> * * private:
> * * int pos[4][4];//location of drop head on screen
> * * * * int trail[16];//information on all characters
> * * int speed;//speed, 1, 2 or 3.
>
> * * public:
>
> * * * * droplet(int x, int y, int spd);
> * * * * ~droplet();
>
> * * * * void draw();
> * * * * void down();
> * * };
>
> * * droplet::droplet(int x, int y, int spd){
> * * int i=0;
> * * * *while(i<16){
> *// * * for (x=0; x<4; x++)
> * // * * * * * *for (y=0; y<4; y++)
> // * * * * * * *{
> * * * * * *pos[4][4] = { x,y };
>
> // * * * * * * *}
> * * * * trail[i] = 32+rand()%223;
> * * * * i++;
> * * * *}
>
> * * * *// pos.Y=y;
> * * * * speed=spd;
> * * }
>
> * * droplet::~droplet(){
> *// * for(int i=0;i<16;i++) delete drops[i];//destorying droplets
> *// * delete[] drops;//destroying droplet pointer array
> * * }
class grid{
int acc;
int dwn;
type * grid;
};
create{
grid = new type [acc*dwn];
}
change (int ac, dw, num){
grid[dw*acc+ac] = num;
}
|