|
|
@@ -18,6 +18,7 @@ var Controller = function(){
|
|
|
{collectible: higgs, probability: 3e-3},
|
|
|
{collectible: electron, probability: .05}
|
|
|
]
|
|
|
+ this.stage = new createjs.Stage("demoCanvas");
|
|
|
}
|
|
|
|
|
|
Controller.prototype.update_views = function(){
|
|
|
@@ -38,7 +39,6 @@ this.prototype.spawn_collectibles = function(){
|
|
|
Controller.prototype.start_game = function(){
|
|
|
// this.session = new Session();
|
|
|
var c = this;
|
|
|
- this.stage = new createjs.Stage("demoCanvas");
|
|
|
createjs.Ticker.on("tick", function(e){c.tick(e);});
|
|
|
createjs.Ticker.setFPS(20);
|
|
|
this.bind_events();
|
|
|
@@ -99,7 +99,7 @@ Controller.prototype.tick = function(event){
|
|
|
|
|
|
Controller.prototype.get_next_cell_position = function(){
|
|
|
var ph0 = this.snake.physicists[0];
|
|
|
- var next_cell = ph0.position;
|
|
|
+ var next_cell = Object.create(ph0.position);
|
|
|
next_cell.x += ph0.direction.x;
|
|
|
next_cell.y += ph0.direction.y;
|
|
|
if (next_cell.x < 0) next_cell.x = this.grid_size.x - 1;
|