O ator antes de colidir já está voltando para o ponto de início. Já alterei o tamanho do diametro e ainda assim estou com esse problema.
//ator
let yAtor = 366
let xAtor = 115
//variável colisão
let colisao = false;
//meus pontos
let meusPontos = 0;
function mostraAtor(){
image(imagemDoAtor,xAtor, yAtor, 30, 30)
}
function movimentaAtor(){
if (keyIsDown(UP_ARROW)){
yAtor -= 3
}
if (keyIsDown(DOWN_ARROW)){
yAtor += 3
}
}
function verificaColisao(){
//collideRectCircle(x1, y1, width1, height1, cx, cy, diameter)
for (let i = 0; i < imagemCarros.length; i++){
colisao = collideRectCircle(xCarros[i], yCarros[i], wCarros[i], hCarros[i], xAtor, yAtor, 15)
if (colisao){
voltaAtorInicio();
}
}
}
function voltaAtorInicio(){
yAtor = 366;
}
function incluiPontos(){
fill(255,240,60)
textAlign(CENTER);
textSize(25);
text(meusPontos, width / 5, 27);
}
function marcaPonto(){
if(yAtor <15){
meusPontos +=1;
voltaAtorInicio();
}
}