generateur + croisement

master
pisouvigne 5 years ago
parent 091cfa7ea4
commit 9977890deb

@ -28,16 +28,22 @@ function createEnd() {
}
function createCircle(x, y) {
var circle = new Konva.Circle({
x: x,
y: y,
radius: 10,
fill: 'black',
stroke: 'black',
strokeWidth: 4,
function createCircle(x, y, name) {
name.forEach(function (idLine) {
var circle = new Konva.Circle({
id: "circle" + idLine,
x: x,
y: y,
radius: 10,
fill: 'black',
stroke: 'black',
strokeWidth: 4,
});
circles.push("circle" + idLine);
layer.add(circle);
});
layer.add(circle);
}
function createSwitch(id, x, y) {

@ -228,10 +228,23 @@ function changeLineColorBlack(idLine) {
setLineStateFalse(idLine);
let line = stage.findOne("#" + idLine);
line.stroke(colorLineInnactive);
console.log(idLine);
circles.forEach(function (circle) {
if (circle === "circle" + idLine) {
stage.findOne("#circle" + idLine).stroke(colorLineInnactive);
stage.findOne("#circle" + idLine).fill(colorLineInnactive);
}
});
}
function changeLineColorYellow(idLine) {
setLineStateTrue(idLine);
circles.forEach(function (circle) {
if (circle === "circle" + idLine) {
stage.findOne("#circle" + idLine).stroke(colorLineActive);
stage.findOne("#circle" + idLine).fill(colorLineActive);
}
});
let line = stage.findOne("#" + idLine);
line.stroke(colorLineActive);
}
@ -923,3 +936,9 @@ function flip() {
});
rotated = !rotated;
}
function setCanvasScale(x, y) {
console.log(document.getElementsByTagName("canvas"));
var ctx = document.getElementsByTagName("canvas").getContext("2d");
console.log(ctx);
}

@ -290,7 +290,7 @@ function createGameOne(niveau) {
numberColonne2 = 1;
timeEnd = 20;
break;
//Fin premiere serie
//Fin premiere serie
case 5:
firstTime.push("inv");
isNotAllowed = true;
@ -542,12 +542,11 @@ function generate2(col, matchs, fork) {
loEntre = findLogique(logiqueEntre[i].id);
}
logiques.forEach(function (logique) {
if (logique.name === logiqueFork.id) createCircle(logique.x + imageWidth + ((loEntre.x - findLogique(logiqueFork.id).x) / 100 * pourcentageBreak), findLogique(logiqueFork.id).y + imageHeight / 2);
if (logique.name === logiqueFork.id) createCircle(logique.x + imageWidth + ((loEntre.x - findLogique(logiqueFork.id).x) / 100 * pourcentageBreak), findLogique(logiqueFork.id).y + imageHeight / 2, logique.id3);
});
fork.splice(fork.indexOf(element), 1);
}
});
}
}
@ -583,6 +582,7 @@ function generate2(col, matchs, fork) {
initEndGame();
invertLine();
checkAllSortieLogique();
console.log(circles);
}
function getNumberFork(arr, col) {

@ -8,6 +8,7 @@ function initAllSwitch(mode) {
layer.draw();
lineUpdate(element);
checkEnd(mode);
setCanvasScale();
});
switche.on('mouseover', function () {
document.body.style.cursor = "pointer";

@ -13,6 +13,7 @@ var switchs = [],
endLines = [],
end, switchsInfo = [],
switchsInfoCopy = [],
circles = [],
lineRemove = [];
var width = window.innerWidth - window.innerWidth / 100 * 30;
var height = window.innerHeight / 2.5;
@ -57,6 +58,7 @@ height = window.innerHeight / 1.5;
function resetAllTabs(save) {
if (!save) {
circles = [];
logiques = [];
numberPerColonne = [];

Loading…
Cancel
Save