9.8.05

Where in the World is Billy?

 

Stage.scaleMode = "noScale";
_root.multiplier = 50;
var stepSizeX = Math.floor(Math.random() * _root.multiplier) + 1;
var stepSizeY = Math.floor(Math.random() * _root.multiplier) + 1;
var currentX = 1;
var currentY = 1;
var sizeX = Stage.width;
var sizeY= Stage.height;
var directionX = 0;
var directionY = 0;
var count = 1;

_root.createEmptyMovieClip("lineX", _root.getNextHighestDepth());
lineX.beginFill(0xFFFFFF, 100);
lineX.lineStyle(1, 0xFFFFFF, 30);
lineX.lineTo(0, Stage.height);;
lineX.endFill();

_root.createEmptyMovieClip("lineY", _root.getNextHighestDepth());
lineY.beginFill(0xFFFFFF, 100);
lineY.lineStyle(1, 0xFFFFFF, 30);
lineY.lineTo(Stage.width, 0);
lineY.endFill();

function advance(axis) {
if (_root["current"+axis] - _root["stepSize"+axis] <= 0) {
_root["direction" + axis] = 0;
_root.stepSizeX = Math.floor(Math.random() * _root.multiplier) + 1;
_root.stepSizeY = Math.floor(Math.random() * _root.multiplier) + 1;
} else if (_root["current"+axis] + _root["stepSize"+axis] >= _root["size"+axis]){
_root["direction" + axis] = 1;
}

if (_root["direction" + axis] == 0){
thisStep = _root["stepSize"+axis];
} else if (_root["direction" + axis] == 1){
thisStep = -(_root["stepSize"+axis]);
}

_root["current"+axis] += thisStep;

}

function plot(){
_root.attachMovie("dot", ["dot" + count], _root.getNextHighestDepth());
_root["dot" + count]._x = _root.currentX;
_root["dot" + count]._y = _root.currentY;
_root.lineX._x = _root.currentX;
_root.lineY._y = _root.currentY;

}

_root.onEnterFrame = function() {
_root.count++;
advance("X");
advance("Y");
plot();
}
stop();