1
0
Fork 0
Browse Source

feat: jump to game over

Signed-off-by: André Jaenisch <andre.jaenisch@posteo.de>
combat-scorched-earth-from-outer-space
André Jaenisch 10 months ago
parent
commit
514b190997
Signed by: ryuno-ki
GPG Key ID: 5A668E771F1ED854
  1. 17
      src/js/app.js

17
src/js/app.js

@ -63,13 +63,18 @@ function tick () {
drawShape(context, astronaut, gravity)
boundaries.forEach(function (boundary) {
if (testCollision(boundary, astronaut)) {
throw new Error('Game Over!')
}
})
try {
boundaries.forEach(function (boundary) {
if (testCollision(boundary, astronaut)) {
throw new Error('Game Over!')
}
})
window.requestAnimationFrame(tick)
window.requestAnimationFrame(tick)
} catch (_) {
console.log('Catched')
location.hash = '#scene-gameover'
}
}
function createObjectsInWorld () {

Loading…
Cancel
Save