I'm creating a peg solitaire game (ie.
I have the stage all set, I'm just sitting here scratching my head on how to make it work.
Code:
function newhole(libName, instName, size, xpos, ypos) {
attachMovie(libName, instName, getNextHighestDepth());
this[instName]._width = size;
this[instName]._height = size;
this[instName]._x = xpos;
this[instName]._y = ypos;
}
function row(libName, instLett, maxrow:Boolean, firstNum:Number, row:Number) {
if (maxrow == true) {
newhole(libName, instLett+(firstNum), 16, 75, row);
newhole(libName, instLett+(firstNum+1), 16, 100, row);
newhole(libName, instLett+(firstNum+2), 16, 125, row);
newhole(libName, instLett+(firstNum+3), 16, 150, row);
newhole(libName, instLett+(firstNum+4), 16, 175, row);
newhole(libName, instLett+(firstNum+5), 16, 200, row);
newhole(libName, instLett+(firstNum+6), 16, 225, row);
} else if (maxrow == false) {
newhole(libName, instLett+(firstNum), 16, 125, row);
newhole(libName, instLett+(firstNum+1), 16, 150, row);
newhole(libName, instLett+(firstNum+2), 16, 175, row);
}
}
row("holeMC", "h", false, 1, 50);
row("holeMC", "h", false, 4, 75);
row("holeMC", "h", true, 7, 100);
row("holeMC", "h", true, 14, 125);
row("holeMC", "h", true, 21, 150);
row("holeMC", "h", false, 28, 175);
row("holeMC", "h", false, 31, 200);
row("pegMC", "p", false, 1, 50);
row("pegMC", "p", false, 4, 75);
row("pegMC", "p", true, 7, 100);
row("pegMC", "p", true, 14, 125);
row("pegMC", "p", true, 21, 150);
row("pegMC", "p", false, 28, 175);
row("pegMC", "p", false, 31, 200);
unloadMovie("p17");
attachMovie("pegMC", "dragPeg", getNextHighestDepth());
this.dragPeg._x = 0;
this.dragPeg._y = 0;
this.dragPeg._width = 16;
this.dragPeg._height = 16;
this.dragPeg._alpha = 0;