A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [F8] arrays and for

  1. #1
    Junior Member
    Join Date
    Sep 2006
    Posts
    15

    [F8] arrays and for

    I'm creating a simple game but as you might have guessed it has alot of variables. My problem is when anyone of my variables hits a wall it does not stop moving.

    this is my code on my main frame
    Code:
    _root.mb1 = false;
    _root.mb2 = false;
    _root.mb3 = false;
    _root.mb4 = false;
    _root.mb5 = false;
    _root.mb6 = false;
    _root.mb7 = false;
    _root.mb8 = false;
    
    _root.balls = new Array("b1","b2","b3","b4","b5","b6","b7","b8");
    
    _root.team = new Array();
    _root.team[0] = ["1p1","1p2","1p3","1p4","1p5","1p6","1p7","1p8","1p9","1p10","1p11","1p12"];
    _root.team[1] = ["2p1","2p2","2p3","2p4","2p5","2p6","2p7","2p8","2p9","2p10","2p11","2p12"];
    The names in the quotes are all the names of my movieclips on stage.

    This is my code on my movieclip wall
    Code:
    onClipEvent(enterFrame){
     for (i=1;i<_root.balls.length; i++){
    	 if (_root.balls[i].hitTest(this)){
    	_root.mb . i = false;
    								}
     }
     for (i=1;i<_root.team[0].length; i++){
    	 if (_root.team[0][i].hitTest(this)){
    		 _root.team[0][i]._y -= _root.speed;
    	 }
     }
      for (i=1;i<_root.team[1].length; i++){
    	 if (_root.team[1][i].hitTest(this)){
    		 _root.team[1][i]._y -= _root.speed;
    	 }
     }
    }
    Thank you so much

  2. #2
    better than chuck norris
    Join Date
    Jun 2004
    Location
    West Coast of Michigan
    Posts
    667
    change _root.mb . i = false; to _root.mb [i] = false; i think.

  3. #3
    Junior Member
    Join Date
    Sep 2006
    Posts
    15
    Yes I figured it out! You can't include quotes or numbers at the start when your trying to control moveclips with arries.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center