Guest User

Untitled

a guest
Jun 11th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. dotArray1 = new Array(d1, d2, d3);
  2. dotArray2 = new Array(d4, d5, d6);
  3. dotArray3 = new Array(d7, d8, d9);
  4. dotArray4 = new Array(d10, d11, d12);
  5.  
  6. chars = new Array();
  7.  
  8. dotArrays = new Array(dotArray1,
  9.                       dotArray2,
  10.                       dotArray3,
  11.                       dotArray4);
  12.  
  13. depth = 100;
  14.  
  15. createCharDelayConst = 20;
  16. createCharDelay = 0;
  17.  
  18. globalSpeed = new Array(.1, .2, .5, 1, 1.5, 2, 2.5, 3, 4, 5, 3, 1.5, .5, -.2, -.3, -.3, -.1);
  19. theSpeed = -1;
  20.  
  21. function onEnterFrame(){
  22.     createCharDelay -= 1;
  23.     if(createCharDelay <= 0){
  24.         createCharDelay = createCharDelayConst;
  25.         char = attachMovie("char", "char" + depth, depth++);
  26.         char._x = -char._width/2;
  27.         char._y = 150 + random(50);
  28.         char.Target = random(3);
  29.         char.dotTo = 0;
  30.         chars.push(char);
  31.     }
  32.    
  33.     theSpeed += 1;
  34.     if(theSpeed >= globalSpeed.length - 1){
  35.         theSpeed = 0;
  36.     }
  37.    
  38.     for(c = chars.length - 1; c >= 0; c--){
  39.         char = chars[c];
  40.         dir = Math.atan2(dotArrays[char.dotTo][char.Target]._y - char._y, dotArrays[char.dotTo][char.Target]._x - char._x);
  41.         if(char.dotTo == 4){
  42.             dir = 0;
  43.         }
  44.         char._x += Math.cos(dir)*globalSpeed[theSpeed]*2;
  45.         char._y += Math.sin(dir)*globalSpeed[theSpeed]*2;
  46.         if(char.hitTest(dotArrays[char.dotTo][char.Target])){
  47.             char.dotTo += 1;
  48.             char.Target = random(3);
  49.         }
  50.     }
  51. }
Add Comment
Please, Sign In to add comment