physicist.js 705 B

1234567891011121314151617181920212223
  1. var Physicist = function(snake, position) {
  2. this.direction = 0;
  3. this.position = position;
  4. this.name = 'Fermi';
  5. this.bonus = '';
  6. this.snake = snake;
  7. };
  8. Physicist.prototype.collect = function(collectible) {
  9. this.bonus += " fat!";
  10. controller.score += collectible.points;
  11. controller.remove_collectible(collectible);
  12. controller.counter += 1;
  13. controller.update_interface();
  14. if(collectible.facts){
  15. if(!controller.facts_shown[collectible.type]){
  16. $("#ticker").html(collectible.facts[0]);
  17. controller.facts_shown[collectible.type] = 1;
  18. } else {
  19. $("#ticker").html(collectible.facts[controller.facts_shown[collectible.type]++]);
  20. }
  21. }
  22. };