So, I have a simple connect the dots game working by drawing lines. The line is drawn when clicking the right dot.
However I want to be able to let the user be able to see the line and the line moves to any dot but only draws if clicking the right one.
this.createEmptyMovieClip("line",1);
line.lineStyle(2,0x000000,100);
dot_array = ["d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10","d11","d12","d13","d14"];
SetStartDot();
SetUpDotButtons();
function SetStartDot() {
lastDot = this["d1"];
curr_dot = 0;
line.moveTo(lastDot._x,lastDot._y);
}
function ConnectDot(mc) {
line.lineTo(mc._x,mc._y);
lastDot = mc;
}
function SetUpDotButtons() {
for (i=0; i<dot_array.length; i++) {
this[dot_array*].onPress = function() {
if (this._name == dot_array[curr_dot]) {
//trace("correct dot");
ConnectDot(this);
curr_dot++;
}
};
this[dot_array*].onRollOver = function() {
this.gotoAndStop(2);
this._xscale=120;
this._yscale=120;
};
this[dot_array*].onRollOut = function() {
this.gotoAndStop(1);
this._xscale=100;
this._yscale=100;
};
}
}