浏览代码

fix physicist initialization, fix performance program

Kevin Heinicke 10 年之前
父节点
当前提交
2479d4aac4
共有 2 个文件被更改,包括 3 次插入1 次删除
  1. 2 1
      js/controller.js
  2. 1 0
      js/views/physicist.js

+ 2 - 1
js/controller.js

@@ -2,6 +2,7 @@ var Controller = function(){
 	this.grid_size = {x: 20, y: 20};
 	this.initial_length = 3;
 	this.time_step = 400;
+    this.maximum_spawns = 100;
 	this.collectibles = [];
 	this.views = [];
 	this.snake = new Snake(this.initial_length);
@@ -134,7 +135,7 @@ Controller.prototype.tick = function(event){
 		this.snake.move(next_cell);
 		this.canTurn = true;
 		if (next_cell_content && next_cell_content.collectible) this.snake.physicists[0].collect(next_cell_content.collectible);
-        if(this.collectibles.length < 2){
+        if(this.collectibles.length < this.maximum_spawns){
 		    this.spawn_collectibles();
         }
         this.update_views();

+ 1 - 0
js/views/physicist.js

@@ -2,6 +2,7 @@
     function PhysicistView(modelObject){
         // this.graphics.beginFill("red").drawCircle(0, 0, window.cell_size * 0.9 / 2);
         // TODO: read those values from json/whatever
+        createjs.Sprite.call(this);
         var width = 131;
         this.width = width;
         var height = 135;