HI thanks for your contribution…but same problem is here again , my question is its ok you can move 'L" shape pipe in diff direction but what about “I” shape …when you click on “I” shape pipe it should move and should not call “L” shape pipe in the display screen…in your code you cant move “I” shape present on the left hand side…
[quote=neilmmm;2333829]i like the game and have had a go … gone in a completely different direction … i don’t think it is the right direction
but here is my code … perhaps someone will respnd to help move it on
var counter:Number = 0;
var mc_id:Number;
var mcConnectionArray:Array=new Array();
var tempArray:Array=newArray();
var mc_type:String;
var empty:MovieClip=this.createEmptyMovieClip("holder",this.getNextHighestDepth());
var target_mc:MovieClip;
function checkleft (target) {
//trace("checkleft called");
//trace (empty["pipe"+target]._name)
//trace ("target array ="+empty["pipe"+target].mcConnectionArray.length)
/*for (k=0;k<empty["pipe"+target].mcConnectionArray.length;k++) {
trace(empty["pipe"+target].mcConnectionArray[k])
}
for (i=0;i<tempArray.length;i++) {
trace (" checking left fornd tempArray = "+tempArray*);
}*/
//if (empty["pipe"+target].mc_type=="straight") {
if (empty["pipe"+target].mcConnectionArray[1]=="right"&&empty["pipe"+(target+1)].mcConnectionArray[3]=="left") {
trace("yep");
trace ("cuurent frame ="+empty["pipe"+(target+1)]._currentframe);
empty["pipe"+(target+1)].gotoAndStop(2);
}else{
trace("no");
empty["pipe"+(target+1)].gotoAndStop(1);
}
//}
}
function spinPipe () {
for (k=0;k<this.mcConnectionArray.length;k++) {
//trace(this.mcConnectionArray[k])
}
this._rotation+=90;
if (this._rotation==0) {
//trace ("rotation =0");
this.mcConnectionArray=["top","right","no","no"];
}else if(this._rotation==90){
//trace ("rotation =90");
this.mcConnectionArray=["no","right","bottom","no"];
}else if(this._rotation==180){
//trace ("rotation =180");
this.mcConnectionArray=["no","no","bottom","left"];
}else{
//trace ("rotation =-90");
this.mcConnectionArray=["top","no","no","left"];
}
tempArray=[];
//trace(this.mc_id);
//trace(this._rotation);
for (k=0;k<this.mcConnectionArray.length;k++) {
//trace(this.mcConnectionArray[k])
tempArray.push(this.mcConnectionArray[k]);
//trace("tempArray "+k+" = "+tempArray[k]);
}
trace("");
trace(this._name);
trace (this.mc_id-1)
checkleft(this.mc_id-1);
}
for (i=0; i<10; i++) {
for (j=0; j<10; j++) {
counter++;
if (j==0) {
var mc:MovieClip = empty.attachMovie("straightPipe", "pipe"+counter, counter);
mc._x = mc._width*j;
mc._y = mc._height*i;
mc.mc_type="straight";
mc.gotoAndStop(2);
mc.mcConnectionArray=["no","right","no","left"];
mc._rotation=90;
mc.mc_id=counter;
//mc.onRelease=spinPipe;
}else if (j==9){
var mc:MovieClip = empty.attachMovie("straightPipe", "pipe"+counter, counter);
mc._x = mc._width*j;
mc._y = mc._height*i;
mc.mc_type="straight";
mc.gotoAndStop(3);
mc.mcConnectionArray=["no","right","no","left"];;
mc._rotation=90;
mc.mc_id=counter;
}else{
var mc:MovieClip = empty.attachMovie("elbowPipe", "pipe"+counter, counter);
mc._x = mc._width*j;
mc._y = mc._height*i;
mc.mc_type="elbow";
mc._rotation=(Math.floor(Math.random()*4)*90);
mc.mc_id=counter;
//// add rotatio id
if (mc._rotation==0) {
mc.mcConnectionArray=["top","right","no","no"];
}else if(mc._rotation==90){
mc.mcConnectionArray=["no","right","bottom","no"];
}else if(mc._rotation==180){
mc.mcConnectionArray=["no","no","bottom","left"];
}else{
mc.mcConnectionArray=["top","no","no","left"];
}
/// end rotation id
mc.onRelease=spinPipe;
}
}
}
empty._xscale=empty._yscale=130
0;
empty._x=(Stage.width- empty._width)/2;
empty._y=(Stage.height- empty._height)/2;
if you look at the attach file
a pipe will change colour if it connects to the one on the left but not dependent on touching one on the left or right
to check right is roughly the asme code but target is +1, to check up is target -10, to below is target +10
i might do more at a later date …if i feel i am going in the right direction[/quote]