diff --git a/README.md b/README.md index d65fe38..47983c5 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Here's what you can see here: * International support * HTML5 sound effects with volume control * Graphical effects -* Realtime timer +* Realtime events * Menu dialogue section #### International support @@ -31,6 +31,26 @@ Please. See `Gulpfile.js.` The trick is to concatenate your files before every build. +#### The custom text cycling +A cycling link is a "replacer" hyperlink that replaces its contents with another text. +The game implies that a situation cannot have more than one cycling link. + +The basic function for a replacer link is this: +`textcycle = (content, ref) -> a(content).replacer(ref).class("cycle").id(ref).toString()` + +The `shoot_pacifist` situation uses only this function to do a text cycle. +But there's also a more advanced version. + +The function `cycle` expects your situation to have a replacer action `cyclewriter` +written like this: + + cyclewriter: (character) -> cycle(this, character) + +Also it expects your situation to have a `cycle_gallery` function. +This is the function that returns your text strings. + +You can see how it's done in the `start` situation. + ## MIT License Copyright © 2015 Alexander Yakovlev, http://en.oreolek.ru diff --git a/game/begin.coffee b/game/begin.coffee index 8da3d83..fc74d65 100644 --- a/game/begin.coffee +++ b/game/begin.coffee @@ -3,11 +3,15 @@ undum = require('undum-commonjs') oneOf = require('raconteur/lib/oneOf.js') qualities = require('raconteur/lib/qualities.js') +# load the translations undumloc = require("./translations/ru.coffee").language undum.language["ru"] = undumloc undumloc = require("./translations/en.coffee").language undum.language["en"] = undumloc + +# jQuery is used for showing the custom controls when the player clicks on title $ = require("jquery") +# jQuery UI is for volume slider require('jquery-ui/slider'); Array.prototype.oneOf = () -> @@ -18,11 +22,16 @@ markdown = new md({ html: true }) +# unique UUID undum.game.id = "7a1aba32-f0fd-4e3b-ba5a-59e3fa9e6012" +# You bump the version each time you make a save-breaking bug, i.e. change the game logic. +# Comment and text changes should be fine. undum.game.version = "3.6" a = require('raconteur/lib/elements.js').a +# link to a different situation. Styled differently. Not used in this project. way_to = (content, ref) -> a(content).class('way').ref(ref) +# link to a writer action. Not used in this project. textlink = (content, ref) -> a(content).once().writer(ref) textcycle = (content, ref) -> a(content).replacer(ref).class("cycle").id(ref).toString() # Cycling link. It's implied there can be only one per situation. @@ -36,11 +45,14 @@ cycle = (obj, character) -> if character.sandbox.cycle_index[obj.name] == responses.length character.sandbox.cycle_index[obj.name] = 0 return textcycle(response, 'cyclewriter') +# usage: writemd( system, "Text to write") writemd = (system, text) -> if typeof text is Function text = text() system.write(markdown.render(text)) +# The first situation. It should be before is_visited because is_visited expects +# the situations array to be already initialized with something. situation "start", cycle_gallery: () -> "christine".l() content: (character) -> diff --git a/game/end.coffee b/game/end.coffee index 1642ea8..4d7b3f1 100644 --- a/game/end.coffee +++ b/game/end.coffee @@ -1,4 +1,7 @@ +# This game does not *show* any qualities but it uses them. +# You can even resurrect the qualities block from the previous commits +# and it would work! qualities head: bullets: qualities.integer("bullets".l()), diff --git a/html/en.html b/html/en.html index 6e246a4..3d32afd 100644 --- a/html/en.html +++ b/html/en.html @@ -41,7 +41,7 @@