invaders/www/index.js

23 lines
550 B
JavaScript

import * as wasm from 'invaders-wasm'
wasm.wasm_main()
function play_game() {
document.getElementById('welcome').classList.add('hidden')
document.getElementById('success').classList.add('hidden')
document.getElementById('failure').classList.add('hidden')
wasm.game_start()
}
function game_won() {
document.getElementById('success').classList.remove('hidden')
}
function game_lost() {
document.getElementById('failure').classList.remove('hidden')
}
window.play_game = play_game
window.game_won = game_won
window.game_lost = game_lost