Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function enterFrameHandler(event:Event):void
- {
- var now:int = getTimer();
- var time:Number = (now - startTime) / 1000;
- currentBar = time / secondsPerBar;
- var barTime:Number = time % secondsPerBar;
- var beat:int = barTime / beatTime;
- measure_tf.text = "Bar : " + currentBar + "\nBeat : " + beat;
- var n:int = arrows.length;
- for (var i:int = n - 1; i > -1; i--)
- {
- var arrow:MovieClip = arrows[i];
- if (frameKeys[arrow.currentFrame] && arrow.hitTestObject(targetLine))
- {
- removeChild(arrow);
- arrows.splice(i, 1);
- continue;
- }
- arrow.y = (time - arrow.time) / speed * 500;
- if (arrow.y >= 600)
- {
- removeChild(arrow);
- arrows.splice(i, 1);
- }
- }
- frameKeys.length = 0;
- currentBeat = beat;
- var position:int = currentBar * 8 + currentBeat;
- if (position >= data.length)
- return;
- var bits:int = data[position];
- if (!bits)
- return;
- for (var shift:int = 0; shift < 4; shift++)
- {
- if (!(bits & 1 << shift))
- continue;
- arrow = new Arrow();
- arrow.time = position * beatTime;
- arrow.gotoAndStop(shift + 1);
- arrow.x = 225 + (arrow.currentFrame - 1) * 50;
- arrow.y = (time - arrow.time) / speed * 500;
- addChild(arrow);
- arrows.push(arrow);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement