mirror of
https://github.com/Febbweiss/sis.git
synced 2026-03-04 22:25:35 +00:00
Bugfix:
* remove unused aliens * right first level
This commit is contained in:
@@ -35,14 +35,15 @@ Game = {
|
|||||||
offset = 0;
|
offset = 0;
|
||||||
|
|
||||||
for (col = 0; col < aliens_row.length; col = col + 1) {
|
for (col = 0; col < aliens_row.length; col = col + 1) {
|
||||||
alien_width_avg = alien_width_avg + aliens_row[col].animation.width;
|
var current_width = typeof aliens_row[col] !== "undefined" ? aliens_row[col].animation.width : ALIENS_TYPE[2].width
|
||||||
|
alien_width_avg = alien_width_avg + current_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
alien_width_avg = alien_width_avg / aliens_row.length;
|
alien_width_avg = alien_width_avg / aliens_row.length;
|
||||||
offset = (PLAYGROUND_WIDTH - (aliens_row.length * 1.5 - 0.5) * alien_width_avg) / 2;
|
offset = (PLAYGROUND_WIDTH - (aliens_row.length * 1.5 - 0.5) * alien_width_avg) / 2;
|
||||||
|
|
||||||
for (col = 0; col < aliens_row.length; col = col + 1) {
|
for (col = 0; col < aliens_row.length; col = col + 1) {
|
||||||
Game.setAlien(col, row, col * wave.length + row, offset, aliens_row[col], Game.wave.move);
|
Game.setAlien(col, row, offset, aliens_row[col], Game.wave.move);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,16 +108,17 @@ Game = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setAlien : function(x, y, id, offset, type, move) {
|
setAlien : function(x, y, offset, type, move) {
|
||||||
"use strict";
|
"use strict";
|
||||||
if( typeof type == "undefined" ) {
|
if( typeof type === "undefined" ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var alien = new Alien("alien" + id, {
|
var id = Game.aliens.length + 1,
|
||||||
|
alien = new Alien("alien" + id, {
|
||||||
x : offset + x * type.animation.width * 1.5,
|
x : offset + x * type.animation.width * 1.5,
|
||||||
y : START_Y + (y * 1.25 * type.animation.height)
|
y : START_Y + (y * 1.25 * type.animation.height)
|
||||||
}, move.move, type);
|
}, move.move, type),
|
||||||
var directions = move.init( alien.x, alien.y );
|
directions = move.init( alien.x, alien.y );
|
||||||
alien.directionX = directions.directionX;
|
alien.directionX = directions.directionX;
|
||||||
alien.directionY = directions.directionY;
|
alien.directionY = directions.directionY;
|
||||||
$("#actors").addSprite("alien" + id, $.extend({posx : alien.x, posy : alien.y}, alien.animation));
|
$("#actors").addSprite("alien" + id, $.extend({posx : alien.x, posy : alien.y}, alien.animation));
|
||||||
|
|||||||
@@ -126,10 +126,10 @@ $(function(){
|
|||||||
posy: PLAYGROUND_HEIGHT - HUD_HEIGHT - 50
|
posy: PLAYGROUND_HEIGHT - HUD_HEIGHT - 50
|
||||||
})
|
})
|
||||||
.end()
|
.end()
|
||||||
.addSprite("alienA", $.extend({posx : 50, posy : 300}, ALIENS[0]))
|
/* .addSprite("alienA", $.extend({posx : 50, posy : 300}, ALIENS[0]))
|
||||||
.addSprite("alienB", $.extend({posx : 50, posy : 400}, ALIENS[1]))
|
.addSprite("alienB", $.extend({posx : 50, posy : 400}, ALIENS[1]))
|
||||||
.addSprite("alienC", $.extend({posx : 50, posy : 500}, ALIENS[2]))
|
.addSprite("alienC", $.extend({posx : 50, posy : 500}, ALIENS[2]))
|
||||||
.addSprite("explosion", {
|
*/ .addSprite("explosion", {
|
||||||
width: 64,
|
width: 64,
|
||||||
height: 64,
|
height: 64,
|
||||||
posx: 100,
|
posx: 100,
|
||||||
|
|||||||
Reference in New Issue
Block a user