You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
168 lines
2.5 KiB
168 lines
2.5 KiB
var stateCount = 9;
|
|
|
|
|
|
function colorSwitch(state){
|
|
|
|
switch (state){
|
|
case -1: return "#373737"; //Gray - Invincible
|
|
case 0: return false; //No brick
|
|
case 1: return "#008800"; //Dark green
|
|
case 2: return "#33FF33"; //Light green
|
|
case 3: return "#99BBFF"; //Light blue
|
|
case 4: return "#0000BB"; //Dark blue
|
|
case 5: return "#AA00DD"; //Purple
|
|
case 6: return "#FF0000"; //Red
|
|
case 7: return "#FF7800"; //Orange
|
|
case 8: return "#FFFF00"; //Yellow
|
|
//Add new colors here
|
|
default: return "#373737";
|
|
}
|
|
}
|
|
|
|
|
|
function tableSwitch(levelNum, level){
|
|
|
|
var c = 0, r = 0;
|
|
|
|
switch (levelNum){
|
|
case 1:
|
|
case 2:
|
|
c = 5;
|
|
r = 10;
|
|
break;
|
|
case 3:
|
|
case 4:
|
|
c = 7;
|
|
r = 12;
|
|
break;
|
|
case 5:
|
|
case 6:
|
|
c = 9;
|
|
r = 14;
|
|
break;
|
|
case 7:
|
|
case 8:
|
|
c = 11;
|
|
r = 16;
|
|
break;
|
|
case 9:
|
|
case 10:
|
|
c = 13;
|
|
r = 18;
|
|
break;
|
|
case 11:
|
|
case 12:
|
|
c = 15;
|
|
r = 20;
|
|
break;
|
|
case 13:
|
|
case 14:
|
|
c = 17;
|
|
r = 22;
|
|
break;
|
|
case 15:
|
|
case 16:
|
|
c = 19;
|
|
r = 24;
|
|
break;
|
|
case 17:
|
|
case 18:
|
|
c = 21;
|
|
r = 26;
|
|
break;
|
|
case 19:
|
|
case 20:
|
|
c = 23;
|
|
r = 28;
|
|
break;
|
|
}
|
|
return {cols: c, rows: r};
|
|
}
|
|
|
|
function designSwitch(levelNum, c, r){
|
|
|
|
var state = 0
|
|
|
|
switch (levelNum) {
|
|
case 1:
|
|
if (r == 3 || r == 6 || r == 9) state = 1;
|
|
break;
|
|
case 2:
|
|
if ((c == 1 || c == 3 || c == 5) && r % 2 == 0) state = 1;
|
|
break;
|
|
case 3:
|
|
if (r == 5 || r == 9){
|
|
if (c == 4) state = -1;
|
|
else if (c == 3 || c == 5) state = 2;
|
|
else state = 1;
|
|
}
|
|
break;
|
|
case 4:
|
|
if (r == 9 && c > 2 && c < 6) state = -1;
|
|
if (r == 8 && c == 4 || r == 7 && c > 2 && c < 6 || r == 6 && c > 1 && c < 7 || r == 5 && c > 2 && c < 6 || r == 4 && c == 4) state = 2;
|
|
break;
|
|
case 5:
|
|
if (r == 1 || r == 14){
|
|
if (c == 1 || c == 9) state = 3;
|
|
if (c == 2 || c == 3 || c == 7 || c == 8) state = 2;
|
|
if (c > 3 && c < 7) state = 1;
|
|
}
|
|
if (r == 2 || r == 13){
|
|
if (c < 3 || c > 7) state = 2;
|
|
}
|
|
if (r == 3 || r == 12){
|
|
if (c == 1 || c == 9) state = 2;
|
|
}
|
|
if (r > 3 && r < 12){
|
|
if (c == 1 || c == 9) state = 1;
|
|
if (r > 6 && r < 9 && c > 3 && c < 7) state = -1;
|
|
}
|
|
break;
|
|
case 6:
|
|
|
|
break;
|
|
case 7:
|
|
|
|
break;
|
|
case 8:
|
|
|
|
break;
|
|
case 9:
|
|
|
|
break;
|
|
case 10:
|
|
|
|
break;
|
|
case 11:
|
|
|
|
break;
|
|
case 12:
|
|
|
|
break;
|
|
case 13:
|
|
|
|
break;
|
|
case 14:
|
|
|
|
break;
|
|
case 15:
|
|
|
|
break;
|
|
case 16:
|
|
|
|
break;
|
|
case 17:
|
|
|
|
break;
|
|
case 18:
|
|
|
|
break;
|
|
case 19:
|
|
|
|
break;
|
|
case 20:
|
|
|
|
break;
|
|
}
|
|
return state;
|
|
} |