|
|
@@ -148,9 +148,11 @@ Controller.prototype.tick = function(event){
|
|
|
this.snake.move(next_cell);
|
|
|
this.canTurn = true;
|
|
|
this.physicists_count();
|
|
|
- while (var next_cell_content = this.is_position_occupied(next_cell)){
|
|
|
+ var next_cell_content = this.is_position_occupied(next_cell);
|
|
|
+ while (next_cell_content){
|
|
|
if (next_cell_content && next_cell_content.collectible) this.snake.physicists[0].collect(next_cell_content.collectible);
|
|
|
if (next_cell_content && next_cell_content.physicist && event.time > 5000) this.game_over();
|
|
|
+ next_cell_content = this.is_position_occupied(next_cell);
|
|
|
}
|
|
|
if(this.collectibles.length < this.maximum_spawns){
|
|
|
this.spawn_collectibles();
|