Erro no console Uncaught ReferenceError: imagemDaEstrada is not defined (sketch: line 14)
Index.js
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.1.9/p5.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.1.9/addons/p5.sound.min.js"></script>
<link rel="stylesheet" type="text/css" href="style.css">
<meta charset="utf-8" />
</head>
<body>
<script src="sketch.js"></script>
<script src="imagens.js"></script>
</body>
</html>
Sketch.js
//carro
let xCarro = 600;
//ator
let yAtor = 366;
function setup() {
createCanvas(500, 400);
}
function draw() {
background(imagemDaEstrada);
mostraAtor();
mostraCarro();
movimentaCarro();
movimentaAtor();
}
function mostraAtor(){
image(imagemDoAtor, 100, yAtor, 30, 30);
}
function mostraCarro(){
image(imagemCarro, xCarro, 40, 50, 40);
}
function movimentaCarro(){
xCarro -= 2;
}
function movimentaAtor(){
if (keyIsDown(UP_ARROW)){
yAtor -= 3;
}
if (keyIsDown(DOWN_ARROW)){
yAtor += 3;
}
}