浏览代码

moved particles to json

Dima Mironov 10 年之前
父节点
当前提交
66dd5c6d0e
共有 2 个文件被更改,包括 9 次插入19 次删除
  1. 1 0
      index.html
  2. 8 19
      js/controller.js

+ 1 - 0
index.html

@@ -7,6 +7,7 @@
 	<script src="js/views/particle.js"></script>
 	<script src="js/models/physicist.js"></script>
 	<script src="js/models/particle.js"></script>
+	<script src="js/models/particles.json.js"></script>
 	<script src="js/models/collectible.js"></script>
 	<script src="js/models/snake.js"></script>
 	<script src="js/controller.js"></script>

+ 8 - 19
js/controller.js

@@ -7,27 +7,16 @@ var Controller = function(){
 	this.views = [];
 	this.snake = new Snake(this.initial_length);
 	this.canTurn = true;
+
+
 	var pos0 = {x: -1, y: -1};
 	
-	var higgs = new Particle(pos0);
-	higgs.mass = 125;
-	higgs.type = "Higgs"
-	var electron = new Particle(pos0);
-	electron.mass = .0005;
-	electron.type = "electron";
-	higgs.draw_properties = {
-		colors: ["hsl(120, 100%, 50%)", "hsl(120, 40%, 50%)"],
-		ratios: [0, 1],
-		inner_radius: .03,
-		outer_radius: .25,
-		inner_center: {x: .07, y: .07},
-		outer_center: {x: 0, y: 0}
-	};
-
-	this.possible_collectibles = [
-		{collectible: higgs, probability: .5},
-		{collectible: electron, probability: .5}
-		]
+	var pp = possible_particles();
+
+	for (var p in pp){
+		this.possible_collectibles.push({collectible: pp[p], probability: pp.p.appearence_probabilty});
+	}
+
 	this.stage = new createjs.Stage("demoCanvas");
 }