From 7cd0b9281163bf4e96ca173f6b624682bfebba21 Mon Sep 17 00:00:00 2001 From: Alexander Yakovlev Date: Sat, 20 May 2017 17:45:50 +0700 Subject: [PATCH] Exiting through the north entrance properly --- game/begin.coffee | 1 + game/story.coffee | 25 ++++++++++++++----------- game/translations/en.cson | 4 ++-- package.json | 4 ++-- sass/main.scss | 4 ++++ 5 files changed, 23 insertions(+), 15 deletions(-) diff --git a/game/begin.coffee b/game/begin.coffee index efe6924..3c4232c 100644 --- a/game/begin.coffee +++ b/game/begin.coffee @@ -70,6 +70,7 @@ sysroom = (name, options) -> options.enter = () -> $("#inventory").hide() options.exit = () -> + salet.view.clearContent('#current-room') $("#inventory").show() options.dsc = () -> return @text.fcall()+"\n\n"+""" diff --git a/game/story.coffee b/game/story.coffee index d0f680a..8e89ca9 100644 --- a/game/story.coffee +++ b/game/story.coffee @@ -26,16 +26,22 @@ salet.init = () -> return "no_cloak".l() @character.take(cloak) -croom "start", +foyer_options = before: () -> "start".l() - dsc: () -> "foyer".l() - ways: ["entrance", "cloakroom", "bar"] - -croom "foyer", - clear: false - dsc: () -> "foyer".l() - ways: ["entrance", "cloakroom", "bar"] title: () -> "foyer_title".l() + dsc: () -> "foyer".l() + ways: ["entrance", "cloakroom", "bar"] + canExit: (to) -> # can't exit to north + if (to == 'entrance') + # print the effect after the room description, after the player enters the room + setTimeout(() -> + salet.view.write(""+"entrance".l()+"") + , 0) + return false + +croom "start", foyer_options +foyer_options.before = null # no title splash after game begins +croom "foyer", foyer_options croom "cloakroom", dsc: () -> "cloakroom".l() @@ -43,9 +49,6 @@ croom "cloakroom", ways: ["foyer"] croom "entrance", - dsc: () -> "entrance".l() - after: () -> - salet.goTo('foyer') title: () -> "entrance_title".l() croom "bar", diff --git a/game/translations/en.cson b/game/translations/en.cson index d01c6b4..03acf85 100644 --- a/game/translations/en.cson +++ b/game/translations/en.cson @@ -12,8 +12,8 @@ start: """ foyer: """ You are standing in a spacious hall, splendidly decorated in red and gold, with glittering chandeliers overhead. - The entrance from the street is to the [north,](north) and there are doorways - [south](south) and [west.](west) + The entrance from the street is to the [north,](entrance) and there are doorways + [south](bar) and [west.](cloakroom) """ credits: """ The game uses code licensed by MIT license. diff --git a/package.json b/package.json index 8f72aab..11bfcd1 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { "dependencies": { - "salet": "^1.7.5" + "salet": "^1.7.7" }, "private": true, "devDependencies": { "bootstrap": "^4.0.0-alpha.5", - "browser-sync": "^2.18.8", + "browser-sync": "^2.18.11", "coffee-script": "^1.12.6", "cson": "^4.1.0", "gulp": "^3.8.11", diff --git a/sass/main.scss b/sass/main.scss index ec0d3c4..9340e9e 100644 --- a/sass/main.scss +++ b/sass/main.scss @@ -155,6 +155,9 @@ hr { } text-align: center; } +.effect { + color: #4c20dd; +} .tab { width: 100%; position: relative; @@ -174,3 +177,4 @@ hr { background: darken($body-bg, 15); } } +