mirror of
https://github.com/Febbweiss/sis.git
synced 2026-03-04 22:25:35 +00:00
Feature: add game over if aliens to low
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
Game = {
|
Game = {
|
||||||
running : false,
|
running : false,
|
||||||
wave_index : -1,
|
wave_index : 0,
|
||||||
wave : undefined,
|
wave : undefined,
|
||||||
aliens : [],
|
aliens : [],
|
||||||
ship : null,
|
ship : null,
|
||||||
@@ -180,8 +180,14 @@ Game = {
|
|||||||
|
|
||||||
$.each(Game.aliens, function(index, alien ) {
|
$.each(Game.aliens, function(index, alien ) {
|
||||||
alien.move();
|
alien.move();
|
||||||
|
var node = alien.node;
|
||||||
|
if( (node.y() + node.h()) > $("#hero").y() ) {
|
||||||
|
Game.running = false;
|
||||||
|
Game.game_over();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if( alien.health > 0 && Math.random() < alien.aggression ) {
|
if( alien.health > 0 && Math.random() < alien.aggression ) {
|
||||||
alien.fire($("#aliensShots"), "alienShot");
|
//alien.fire($("#aliensShots"), "alienShot");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user