|
|
@ -36,13 +36,13 @@ export class State extends map.TMap { |
|
|
|
}; |
|
|
|
|
|
|
|
this.win = false; |
|
|
|
this.p1 = new mover.Mover(map.p1_pos.x, map.p1_pos.y, this); |
|
|
|
this.p1 = new mover.Mover(map.p1_pos.x, map.p1_pos.y, this, 1); |
|
|
|
|
|
|
|
if (two_player) { |
|
|
|
if (!map.p2_pos) { |
|
|
|
throw "missing p2 pos in map !"; |
|
|
|
} |
|
|
|
this.p2 = new mover.Mover(map.p2_pos.x, map.p2_pos.y, this); |
|
|
|
this.p2 = new mover.Mover(map.p2_pos.x, map.p2_pos.y, this, 2); |
|
|
|
this.exit = null; |
|
|
|
} else { |
|
|
|
if (!map.exit) { |
|
|
@ -78,18 +78,21 @@ export class State extends map.TMap { |
|
|
|
}; |
|
|
|
block_has_bomb(p /*: point.Point */) { |
|
|
|
return this.bombs.some(function (b) { return b.is_on_block(p) }); |
|
|
|
} |
|
|
|
}; |
|
|
|
block_has_bonus(p /*: point.Point */) { |
|
|
|
return this.bonuses.some(function (b) { return b.is_on_block(p) }); |
|
|
|
} |
|
|
|
add_bomb(p /*: point.Point */) { |
|
|
|
}; |
|
|
|
mover_has_bomb(id /*: number */) { |
|
|
|
return this.bombs.some(function (b) { return b.owner == id }); |
|
|
|
}; |
|
|
|
add_bomb(p /*: point.Point */, owner /*: number */) { |
|
|
|
if (!this.block_has_bomb(p)) { |
|
|
|
this.bombs.push(new bomb.Bomb(p, false)); |
|
|
|
this.bombs.push(new bomb.Bomb(p, false, owner)); |
|
|
|
} |
|
|
|
}; |
|
|
|
add_super_bomb(p /*: point.Point */) { |
|
|
|
add_super_bomb(p /*: point.Point */, owner /*: number */) { |
|
|
|
if (!this.block_has_bomb(p)) { |
|
|
|
this.bombs.push(new bomb.Bomb(p, true)); |
|
|
|
this.bombs.push(new bomb.Bomb(p, true, owner)); |
|
|
|
} |
|
|
|
} |
|
|
|
add_fire(p /*: point.Point */) { |
|
|
|