restart waiting game
This commit is contained in:
@@ -25,5 +25,6 @@
|
||||
border: solid 2px black;
|
||||
padding: 1em;
|
||||
background: #ccc;
|
||||
z-index: 9999
|
||||
z-index: 9999;
|
||||
cursor:pointer;
|
||||
}
|
||||
@@ -26,6 +26,17 @@ function initInvaders(parentDivId) {
|
||||
$('#'+invaders_parentDivId).offset({ top: parent.offset().top, left: parent.offset().left})
|
||||
$('#'+invaders_parentDivId).height(parent.height());
|
||||
$('#'+invaders_parentDivId).width(parent.width());
|
||||
|
||||
$('.invader_notify').click(function() {
|
||||
// restart the game
|
||||
$('#'+invaders_parentDivId).remove();
|
||||
initInvaders(parentDivId);
|
||||
invaders_game_over = false;
|
||||
invaders_kills = 0;
|
||||
invaders_points = 0;
|
||||
|
||||
startInvaders();
|
||||
});
|
||||
}
|
||||
|
||||
function gameOver() {
|
||||
@@ -46,11 +57,13 @@ function clearIntervals() {
|
||||
}
|
||||
|
||||
function startInvaders() {
|
||||
|
||||
$('#'+invaders_parentDivId).show();
|
||||
|
||||
if (!invaders_game_over) {
|
||||
if (invaders_count == 0) {
|
||||
addInvader(invaders_parentDivId);
|
||||
}
|
||||
$('#'+invaders_parentDivId).show();
|
||||
|
||||
clearIntervals();
|
||||
invaders_game_move=window.setInterval("moveRandomly('"+invaders_parentDivId+"')",100);
|
||||
|
||||
Reference in New Issue
Block a user