Uncaught SyntaxError: Identifier 'colidiu' has already been declared (ator: line 1) Uncaught ReferenceError: Cannot access 'xAtor' before initialization (ator: line 8)
//códigos do ator
//variáveis
let xAtor = 40;
let yAtor = 370;
function mostraAtor(){
image(imagemAtor, xAtor, yAtor, 30, 25);
}
function movimentaAtor(){
if (keyIsDown(UP_ARROW)){
yAtor -= 3;
}
if (keyIsDown(DOWN_ARROW)){
yAtor += 3;
}
}
function verificaColisao(){
for (let i = 0; i < imagemCarros.length; i = i + 1){
colisao = collideRectCircle(xCarros[i], yCarros[i], comprimentoCarro, alturaCarro, xAtor, yAtor,15);
if (colisao){
colidiu();
}
}
}
function colidiu() {
yAtor = 370;
}