2
I am making a board game, it is working all right, however, I would like it to activate mini games according to the position that the player stop.
This is also working, what is not working is the fact that it performs everything before even starting the delay of movement that I use to make the character move.
This is where the movement happens.
var i = 1; // set your counter to 1
var fimloop;
function myLoop () { // create a loop
function setTimeout(function () { // call a 3s setTimeout when the loop is called
posicao++;
$('#contaPosicoes').val(posicao).trigger('change');
moveRight(circle,posicao); // your code here
i++; // increment the counter
if ((i < evt+1)&&(posicao<38)) { // if the counter < 10, call the loop function
myLoop(); // .. again which will trigger another
//fimloop = false;
} // .. setTimeout()
}, 300);
fimloop = true;
}
myLoop();
I would like to do anything only after this loop is over.
Alan, you don’t need to put "Solved" in the title. The correct thing is to accept the answer that solved your problem, see in the FAQ how to do it.
– hkotsubo
Sorry, that was my first question and I ended up not reading the rules by the hurry to deliver this job, thanks to you too.
– Alan Borim
To accept the answer click on the 'V' below the number of votes that will turn green.
– Bruno Romualdo