Chronos234 commited on
Commit
6cd456b
·
verified ·
1 Parent(s): 63cf1ad

Update game.js

Browse files
Files changed (1) hide show
  1. game.js +4 -0
game.js CHANGED
@@ -12,7 +12,9 @@ let enemies = [];
12
  towers.push(new Tower(canvas.width / 2, canvas.height / 2));
13
  enemies.push(new Enemy(canvas.width / 2, 100));
14
 
 
15
  function update() {
 
16
  ctx.clearRect(0, 0, canvas.width, canvas.height);
17
 
18
  // Atualizar torres
@@ -25,7 +27,9 @@ function update() {
25
  enemy.update();
26
  }
27
 
 
28
  requestAnimationFrame(update);
29
  }
30
 
 
31
  update();
 
12
  towers.push(new Tower(canvas.width / 2, canvas.height / 2));
13
  enemies.push(new Enemy(canvas.width / 2, 100));
14
 
15
+ // Função para desenhar e atualizar as entidades
16
  function update() {
17
+ // Limpar a tela
18
  ctx.clearRect(0, 0, canvas.width, canvas.height);
19
 
20
  // Atualizar torres
 
27
  enemy.update();
28
  }
29
 
30
+ // Continuar o loop de animação
31
  requestAnimationFrame(update);
32
  }
33
 
34
+ // Começar a atualização do jogo
35
  update();