Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dotArray1 = new Array(d1, d2, d3);
- dotArray2 = new Array(d4, d5, d6);
- dotArray3 = new Array(d7, d8, d9);
- dotArray4 = new Array(d10, d11, d12);
- chars = new Array();
- dotArrays = new Array(dotArray1,
- dotArray2,
- dotArray3,
- dotArray4);
- depth = 100;
- createCharDelayConst = 20;
- createCharDelay = 0;
- globalSpeed = new Array(.1, .2, .5, 1, 1.5, 2, 2.5, 3, 4, 5, 3, 1.5, .5, -.2, -.3, -.3, -.1);
- theSpeed = -1;
- function onEnterFrame(){
- createCharDelay -= 1;
- if(createCharDelay <= 0){
- createCharDelay = createCharDelayConst;
- char = attachMovie("char", "char" + depth, depth++);
- char._x = -char._width/2;
- char._y = 150 + random(50);
- char.Target = random(3);
- char.dotTo = 0;
- chars.push(char);
- }
- theSpeed += 1;
- if(theSpeed >= globalSpeed.length - 1){
- theSpeed = 0;
- }
- for(c = chars.length - 1; c >= 0; c--){
- char = chars[c];
- dir = Math.atan2(dotArrays[char.dotTo][char.Target]._y - char._y, dotArrays[char.dotTo][char.Target]._x - char._x);
- if(char.dotTo == 4){
- dir = 0;
- }
- char._x += Math.cos(dir)*globalSpeed[theSpeed]*2;
- char._y += Math.sin(dir)*globalSpeed[theSpeed]*2;
- if(char.hitTest(dotArrays[char.dotTo][char.Target])){
- char.dotTo += 1;
- char.Target = random(3);
- }
- }
- }
Add Comment
Please, Sign In to add comment