munch
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 

36 рядки
733 B

  1. "use strict";
  2. function DialogNode() {
  3. this.text = "Foo bar baz.";
  4. this.hooks = [];
  5. this.visit = function() {
  6. for (let i=0; i<this.hooks.length; i++)
  7. this.hooks[i]();
  8. return this.text;
  9. }
  10. this.choices = [];
  11. this.addChoice = function(text,node) {
  12. this.choices.push({"text": text, "node": node});
  13. }
  14. }
  15. function EatDude() {
  16. DialogNode.call(this);
  17. this.text = "You approach the nerd.";
  18. let eatHim = new DialogNode();
  19. eatHim.text = "You eat the nerd. Burp.";
  20. eatHim.hooks.push(function() { player.health += 100 } );
  21. let dontEatHim = new DialogNode();
  22. dontEatHim.text = "You don't eat the nerd.";
  23. this.addChoice("Eat him lol",eatHim);
  24. this.addChoice("Actually don't",dontEatHim);
  25. }