Advertisement
Guest User

tttt

a guest
Oct 15th, 2011
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function enterFrameHandler(event:Event):void
  2. {
  3.     var now:int = getTimer();
  4.     var time:Number = (now - startTime) / 1000;
  5.     currentBar = time / secondsPerBar;
  6.     var barTime:Number = time % secondsPerBar;
  7.     var beat:int = barTime / beatTime;
  8.     measure_tf.text = "Bar  : " + currentBar + "\nBeat : " + beat;
  9.     var n:int = arrows.length;
  10.     for (var i:int = n - 1; i > -1; i--)
  11.     {
  12.         var arrow:MovieClip = arrows[i];
  13.         if (frameKeys[arrow.currentFrame] && arrow.hitTestObject(targetLine))
  14.         {
  15.             removeChild(arrow);
  16.             arrows.splice(i, 1);
  17.             continue;
  18.         }
  19.         arrow.y = (time - arrow.time) / speed * 500;
  20.         if (arrow.y >= 600)
  21.         {
  22.             removeChild(arrow);
  23.             arrows.splice(i, 1);
  24.         }
  25.     }
  26.     frameKeys.length = 0;
  27.     currentBeat = beat;
  28.     var position:int = currentBar * 8 + currentBeat;
  29.     if (position >= data.length)
  30.         return;
  31.     var bits:int = data[position];
  32.     if (!bits)
  33.         return;
  34.     for (var shift:int = 0; shift < 4; shift++)
  35.     {
  36.         if (!(bits & 1 << shift))
  37.             continue;
  38.         arrow = new Arrow();
  39.         arrow.time = position * beatTime;
  40.         arrow.gotoAndStop(shift + 1);
  41.         arrow.x = 225 + (arrow.currentFrame - 1) * 50;
  42.         arrow.y = (time - arrow.time) / speed * 500;
  43.         addChild(arrow);
  44.         arrows.push(arrow);
  45.     }
  46. }
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement