munch
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 

34 líneas
615 B

  1. function Creature(name = "Creature") {
  2. this.name = name;
  3. this.health = 100;
  4. this.maxHealth = 100;
  5. this.mass = 80;
  6. this.stomach = Stomach();
  7. }
  8. function Player(name = "Player") {
  9. Creature.call(this, name);
  10. this.fullness = 100;
  11. this.maxFullness = 200;
  12. }
  13. function Container(name = "stomach") {
  14. this.name = name;
  15. this.contents = [];
  16. this.digest = function() {
  17. };
  18. }
  19. function Stomach() {
  20. Container.call(this, "stomach");
  21. this.digest = function() {
  22. let lines = [];
  23. this.contents.forEach(function (prey) {
  24. lines.push("Something is digesting!");
  25. });
  26. return lines;
  27. }
  28. }