Randomly placing an odd MC in a grid of 24

  • Kloucek
  • Born
  • Born
  • Kloucek
  • Posts: 1

Post 3+ Months Ago

I'm creating a grid of 24 (6 by 4) instances of the same movie clip wit a simple loop:
Code: [ Select ]
for (var i:uint=1 ; i<=24 ; i++){
                for (var x:uint=0 ; x <6 ; x++ ){
                    for (var y:uint=0 ; y<4 ; y++){
                        var c:Tile = new Tile();
                        
                        c.x = x*63;
                        c.y = y*63;
                        var r:uint = Math.floor(Math.random()*24);
                        
                        addChild(c);
  1. for (var i:uint=1 ; i<=24 ; i++){
  2.                 for (var x:uint=0 ; x <6 ; x++ ){
  3.                     for (var y:uint=0 ; y<4 ; y++){
  4.                         var c:Tile = new Tile();
  5.                         
  6.                         c.x = x*63;
  7.                         c.y = y*63;
  8.                         var r:uint = Math.floor(Math.random()*24);
  9.                         
  10.                         addChild(c);

I want one of them to be different (either a different MC, or just the same mc starting from a different frame.) and placed randomly within the grid. Of course i would like to assign a different action to it.

I got as far as to this part. I'm just starting in AS3, and this will be a school project. Please help

Post Information

  • Total Posts in this topic: 1 post
  • Users browsing this forum: No registered users and 4 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.