0
#branchID pool
branch0 = "This is a wall of text. This is a wall of text. This is a wall of text. This is a wall of text. This is a wall of text. This is a wall of text."
branch1 = "This is a second wall of text."
branch2 = "This is a third wall of text."
#classes section
#pulls text from pools above.
branch = (name, branchid)->
stringID = String(branchid)
document.write("<h1 id=\'#{stringID}\'>#{name}</h1>")
document.getElementById(stringID).onclick = ->
document.write(branchid)
#This is where the game goes. It will be built with conditionals
window.onload = ->
branch('Start', branch0)
CoffeeScriptを使用してブラウザベースの「自分で冒険を選んで」ゲームを作成しています。上記は私がこれまでに持っていたコードです。 HTML要素が作成され、クリックされると、1つの巨大なブロックのページにテキスト文字列が書き込まれます。大きな文字列を一度に1クリックで表示する
私の質問は、どのようにして一度に文章だけが読み込まれ、クリックされると次の文章が読み込まれ、次に文字列に何も残らなくなるまで次の文章が読み込まれます。
どうもありがとうございました。これは非常に役に立ちます。 – bryanwillis7