Array problem with whole row setting instead of single cell.

  • biznuge
  • Born
  • Born
  • biznuge
  • Posts: 2

Post 3+ Months Ago

Code: [ Select ]
on (press)
{
    _global.cogrot[1];
    _global.cogarray = new Array(5,6);
    _global.matflag = new Array(1);
}

on (releaseOutside)
{
    var madvar=1000;
    var num1;
    var num2;
        overpeg=0;
    //stopDrag();
        for (num1=1; num1<=4; num1++)
        {    for (num2=1; num2<=5; num2++)
            {    if (this._x>((73.5*num1)+105.3))
                {    if (this._x<((73.5*num1)+105.3+16))
                    {    if (this._y>((73.5*num2)+20.2))
                        {    if (this._y<((73.5*num2)+20.2+16))
                            {    this._x=(num1*73.5)+105.3+8;
                                this._y=(num2*73.5)+20.2+8;
                                trace(1000000);
                                for (num3=0; num3<=5; num3++)
                                {    for (num4=0; num4<=6; num4++)
                                    {    trace(_global.cogarray[num3,num4]);
                                    }
                                }
                                trace(1000000);
This line is causing the problem....            
                    ----------->_global.cogarray[num1,num2]=1;
  1. on (press)
  2. {
  3.     _global.cogrot[1];
  4.     _global.cogarray = new Array(5,6);
  5.     _global.matflag = new Array(1);
  6. }
  7. on (releaseOutside)
  8. {
  9.     var madvar=1000;
  10.     var num1;
  11.     var num2;
  12.         overpeg=0;
  13.     //stopDrag();
  14.         for (num1=1; num1<=4; num1++)
  15.         {    for (num2=1; num2<=5; num2++)
  16.             {    if (this._x>((73.5*num1)+105.3))
  17.                 {    if (this._x<((73.5*num1)+105.3+16))
  18.                     {    if (this._y>((73.5*num2)+20.2))
  19.                         {    if (this._y<((73.5*num2)+20.2+16))
  20.                             {    this._x=(num1*73.5)+105.3+8;
  21.                                 this._y=(num2*73.5)+20.2+8;
  22.                                 trace(1000000);
  23.                                 for (num3=0; num3<=5; num3++)
  24.                                 {    for (num4=0; num4<=6; num4++)
  25.                                     {    trace(_global.cogarray[num3,num4]);
  26.                                     }
  27.                                 }
  28.                                 trace(1000000);
  29. This line is causing the problem....            
  30.                     ----------->_global.cogarray[num1,num2]=1;

Gives an output in the array which looks like.....

//0 0 0 0 0 0.............................0 0 0 0 0 0
//1 1 1 1 1 1.............................0 0 0 0 0 0
//0 0 0 0 0 0............or..............0 0 0 0 0 0
//0 0 0 0 0 0.............................0 0 0 0 0 0
//0 0 0 0 0 0.............................1 1 1 1 1 1
//0 0 0 0 0 0.............................0 0 0 0 0 0
//0 0 0 0 0 0.............................0 0 0 0 0 0

//depending on where the object has been dropped...

//as you can see, instead of setting a single cell of the array it sets an entire line..

//I really don't have a clue what could be the problem with this single
//line of code, but this is definately where the problem lies!!!

Code: [ Select ]
                                trace(1000000);
                                for (num3=0; num3<=5; num3++)
                                {    for (num4=0; num4<=6; num4++)
                                    {    trace(_global.cogarray[num3,num4]);
                                    }
                                }
                                trace(1000000);
                                
                                _global.num1glob=num1;
                                _global.num2glob=num2;
                                overpeg=1;
                                oddeven=(num1+num2)%2
                                
                                checkmatrix(num1,num2);
                                
                                
                                
                                if (_global.matflag[1]>0){
                                if (oddeven<1)
                                {
                                    _global.cogrot[1]=-5;
                                }
                                if (oddeven>0)
                                {
                                    _global.cogrot[1]=5;
                                }}
                                _global.matflag[1]=0;
                            }
                        }
                    }
                }
            }
        }
    if (overpeg<1)
    {
        this._x=initx;
        this._y=inity;
    }
}
  1.                                 trace(1000000);
  2.                                 for (num3=0; num3<=5; num3++)
  3.                                 {    for (num4=0; num4<=6; num4++)
  4.                                     {    trace(_global.cogarray[num3,num4]);
  5.                                     }
  6.                                 }
  7.                                 trace(1000000);
  8.                                 
  9.                                 _global.num1glob=num1;
  10.                                 _global.num2glob=num2;
  11.                                 overpeg=1;
  12.                                 oddeven=(num1+num2)%2
  13.                                 
  14.                                 checkmatrix(num1,num2);
  15.                                 
  16.                                 
  17.                                 
  18.                                 if (_global.matflag[1]>0){
  19.                                 if (oddeven<1)
  20.                                 {
  21.                                     _global.cogrot[1]=-5;
  22.                                 }
  23.                                 if (oddeven>0)
  24.                                 {
  25.                                     _global.cogrot[1]=5;
  26.                                 }}
  27.                                 _global.matflag[1]=0;
  28.                             }
  29.                         }
  30.                     }
  31.                 }
  32.             }
  33.         }
  34.     if (overpeg<1)
  35.     {
  36.         this._x=initx;
  37.         this._y=inity;
  38.     }
  39. }
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13502
  • Loc: Florida

Post 3+ Months Ago

Welcome to Ozzu Biznuge :)

Please remember to use
Code: [ Select ]

tags when posting code on the boards.
  • biznuge
  • Born
  • Born
  • biznuge
  • Posts: 2

Post 3+ Months Ago

thanks for the tip

This thread has now been answered!

thanx! :idea:

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 15 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.