wowtigger
10-03-2001, 11:11 AM
Hey people,
Trying to create an opening with lines that move around the screen randomly.
Got the random bit going, the lines are going to slide for oldX to newX and oldY to newY with 0.5 intervals.
I cannot seem to get the sliding function to work at all!
This is the code:
---------------------------------------------------------------------------------
function createRandom() {
do {
newX = Math.round(Math.random() * 500);
} while ((newX < 0) or (newX >500));
do {
newY = Math.round(Math.random() * 400);
} while ((newY < 0) or (newY > 400));
setProperty ("Horiz_Line", _y, newY);
setProperty ("Vert_Line", _x, newX);
oldX = getProperty ( "VerticalLine", _x );
oldY = getProperty ( "HorizontalLine", _y );
//moveLine (newX, newY);
}
function moveLine(newX, newY) {
oldX = getProperty ( "VerticalLine", _x );
oldY = getProperty ( "HorizontalLine", _y );
if ((oldY < newY) and (oldX < newX)) then
do {
if (oldY <> newY) {
oldY = oldY + 0.5;
setProperty ("Horizontal Line", _y, oldY);
}
if (oldX <> newX) {
oldX - oldX + 0.5;
setProperty ("vertical Line", _x, oldX);
}
} while ((oldY <> newY) and (oldX <> newX));
}
stop()
---------------------------------------------------------------------------------
I have renamed the Vertical Line - Vert_Line and Horizontal Line - Horiz_Line.
Please can someone help.
wowgareth@orange.net
Trying to create an opening with lines that move around the screen randomly.
Got the random bit going, the lines are going to slide for oldX to newX and oldY to newY with 0.5 intervals.
I cannot seem to get the sliding function to work at all!
This is the code:
---------------------------------------------------------------------------------
function createRandom() {
do {
newX = Math.round(Math.random() * 500);
} while ((newX < 0) or (newX >500));
do {
newY = Math.round(Math.random() * 400);
} while ((newY < 0) or (newY > 400));
setProperty ("Horiz_Line", _y, newY);
setProperty ("Vert_Line", _x, newX);
oldX = getProperty ( "VerticalLine", _x );
oldY = getProperty ( "HorizontalLine", _y );
//moveLine (newX, newY);
}
function moveLine(newX, newY) {
oldX = getProperty ( "VerticalLine", _x );
oldY = getProperty ( "HorizontalLine", _y );
if ((oldY < newY) and (oldX < newX)) then
do {
if (oldY <> newY) {
oldY = oldY + 0.5;
setProperty ("Horizontal Line", _y, oldY);
}
if (oldX <> newX) {
oldX - oldX + 0.5;
setProperty ("vertical Line", _x, oldX);
}
} while ((oldY <> newY) and (oldX <> newX));
}
stop()
---------------------------------------------------------------------------------
I have renamed the Vertical Line - Vert_Line and Horizontal Line - Horiz_Line.
Please can someone help.
wowgareth@orange.net