-
Notifications
You must be signed in to change notification settings - Fork 0
/
sketch.js
33 lines (29 loc) · 682 Bytes
/
sketch.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
let colidiu = false;
function setup() {
createCanvas(600, 500);//TAMANHO
trilhaS.loop();//SOM
}
function draw() {
background(estrada);//FUNDO
mostraA();
movimentaA();
limiteA();
mostraC();
movimentaC();
voltaC();
mostraP();
marcaP();
colisao();
}
function colisao(){//COLISAO CARRO E ATOR
for (let a = 0; a < C.length; a += 1){//VARIAVEIS E LISTAS
colidiu = collideRectCircle(xC[a], yC[a], comprimentoC, alturaC, xA, yA, 15);//COLISAO CARRO E ATOR
if (colidiu){//SE COLIDIU
colisaoS.play();//SOM
yA = 461;//VOLTAR
if (pontosA > 0){//SE PONTOS MAIOR QUE ZERO
pontosA -= 1//PONTOS + 1
}
}
}
}