mirror of
https://github.com/danbee/invaders
synced 2025-03-04 08:39:08 +00:00
20 lines
408 B
JavaScript
20 lines
408 B
JavaScript
function update () {
|
|
playerMovement();
|
|
|
|
// Firing?
|
|
if (fireButton.isDown && player.alive) {
|
|
fireBullet();
|
|
}
|
|
|
|
// Restart?
|
|
if (restartButton.isDown && lives == 0) {
|
|
restartGame();
|
|
}
|
|
|
|
// Handle aliens dropping bombs
|
|
handleBombs();
|
|
|
|
game.physics.arcade.overlap(bullets, aliens, bulletHitsAlien, null, this);
|
|
game.physics.arcade.overlap(bombs, player, bombHitsPlayer, null, this);
|
|
}
|