Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Meowkewok authored Dec 20, 2024
1 parent 316a83a commit e0f9199
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions games/SkyFall.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,24 +93,20 @@ function respawnMeteor() {

function moveMeteors() {
const meteorSprites = getAll(meteor);

if (meteorSprites.length < 4) {
respawnMeteor();
}

meteorSprites.forEach(meteorSprite => {
meteorSprite.y += 1;

if (meteorSprite.y >= height() - 1) {
if (Math.random() > 0.75) {
respawnMeteor();
}
detectCollisions();
meteorSprite.remove();
}

detectCollisions();
});

if (meteorSprites.length < 4) {
respawnMeteor();
}
}

onInput("j", () => {
Expand Down

0 comments on commit e0f9199

Please sign in to comment.