diff --git a/game/game.coffee b/game/game.coffee index df6f124..1c390e6 100644 --- a/game/game.coffee +++ b/game/game.coffee @@ -2,11 +2,19 @@ inkjs = require("inkjs") continueToNextChoice = (s) -> while (s.canContinue) - $("#content").append("

#{s.Continue()}

") + paragraphs = s.Continue().split("\n") + delay = 1000 + for i in paragraphs + if i != "" + html = $.parseHTML(i) + $("#content").append($('

').hide().html(html).fadeIn(delay)) + delay += 500 + scrollTo = $('#options').offset().top if (s.currentChoices.length > 0) - $("#options").html("") + $("#options").html("").hide() for choice in s.currentChoices $("#options").append("

  • #{choice.text}
  • ") + $("#options").fadeIn(800) $("#options li a").click(() -> s.ChooseChoiceIndex($(this).data("index")) continueToNextChoice(s) @@ -15,6 +23,9 @@ continueToNextChoice = (s) -> else $("#content").append("

    THE END

    ") $("#options").html("") + $('html, body').animate({ + scrollTop: scrollTo + }, 800) fetch('fogg.ink.json') .then((response) ->