From eafad99c7e9e5f8de570f19bca9a917d74ad592d Mon Sep 17 00:00:00 2001 From: brisberg Date: Mon, 9 Nov 2020 00:12:09 -0800 Subject: [PATCH] Copied in the game files from brisberg/twine-games --- .cruft.json | 4 +- README.md | 17 ++++++- header/header.html | 2 - header/init.js | 33 ++++++++++++++ package.json | 2 +- src/build.yml | 9 ++++ src/events.tw | 60 ++++++++++++++++++++++++ src/main.tw | 25 +++++++++- src/story.tw | 111 +++++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 255 insertions(+), 8 deletions(-) delete mode 100644 header/header.html create mode 100644 header/init.js create mode 100644 src/build.yml create mode 100644 src/events.tw create mode 100644 src/story.tw diff --git a/.cruft.json b/.cruft.json index 9180414..02533f4 100644 --- a/.cruft.json +++ b/.cruft.json @@ -8,9 +8,9 @@ "github_username": "brisberg", "title": "Journey", "repo_slug": "journey", - "description": "Journey across the sea and overcome challenges along the way.", + "description": "Travel the high seas, overcoming challenges in an Oregon Trail inspired game.", "_template": "https://github.com/brisberg/cruft-spindle-project/" } }, "directory": null -} \ No newline at end of file +} diff --git a/README.md b/README.md index 2ef1bd7..eac7289 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,21 @@ # Journey -Journey across the sea and overcome challenges along the way. +Travel the high seas, overcoming challenges in an Oregon Trail inspired game. + +Twine 2.3.7\ +Tweego 2.1.1\ +SugarCube 2.31.1 + +### Features + +- Mainly a test game to explore some mechanics of SugarCube +- Random series of event cards +- Item pick ups (keys) +- Startup, Footer passages +- Simple Google Analytics with Custom Events + +### Tutorials +- None ## Toolchain diff --git a/header/header.html b/header/header.html deleted file mode 100644 index 685505b..0000000 --- a/header/header.html +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/header/init.js b/header/init.js new file mode 100644 index 0000000..c216171 --- /dev/null +++ b/header/init.js @@ -0,0 +1,33 @@ +// Game Name key (for analytics) +window.GAME_NAME = 'journey'; + +// Setup Initial Static Data +setup = { + initialState: { + distance: 100, + hull: 20, + crew: 10, + fuel: 8, + }, + events: [ + 'Calm Seas', + 'Rough Seas', + 'Storm', + 'Old Shipwreck', + 'Raft', + 'Friendly Port', + ], + hullMax: 20, + crewMax: 15, + fuelMax: 15, +}; + +// Setup custom functions +window.customPrint = () => { + return 'This is a custom print'; +}; + +window.randomEvent = () => { + const index = Math.floor(Math.random() * setup.events.length); + return setup.events[index]; +} diff --git a/package.json b/package.json index e9a9156..3b4f3b8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "journey", "version": "0.1.0", - "description": "Journey across the sea and overcome challenges along the way.", + "description": "Travel the high seas, overcoming challenges in an Oregon Trail inspired game.", "scripts": { "build": "yarn run spindle", "test": "echo \"Error: no test specified\" && exit 1" diff --git a/src/build.yml b/src/build.yml new file mode 100644 index 0000000..4f98e73 --- /dev/null +++ b/src/build.yml @@ -0,0 +1,9 @@ +id: "journey" +version: "1.0.0" +title: "Journey" +description: "Travel the high seas, overcoming challenges in an Oregon Trail inspired game." +head: + - "shared/analytics/header/analytics.html" +deps: + - "games/journey" + - "shared/analytics/js" diff --git a/src/events.tw b/src/events.tw new file mode 100644 index 0000000..69d875f --- /dev/null +++ b/src/events.tw @@ -0,0 +1,60 @@ +:: Calm Seas +The seas are calm with a slight, salty southernly breeze. Your crew are in good spirits as they unfurl the \ +sails and tend to the rigging. + +You spot a flying fish leap from the water but it is too far to catch. + + +:: Rough Seas +<>\ +Strong winds whip the ocean up into a rage. Tall waves crash over the deck, as your crew hurries to secure \ +supplies to the deck and lower the top sails. + +Before your crew is finished, a large wave washes a crate of coal overboard. + + +:: Storm +<>\ +A violent sea squal approaches rapidly from the north. Your crew rush to stow the sails and take the heavy \ +supplies below deck to ride it out. Rain drenches your face as you try to keep the ship on course. + +Above there is a brillient flash of lightning, followed imediatly by a deafening thunderclap. A crewmen on \ +the rigging loses his footing on the rain slick beams and falls overboard. + +"Man Overboard!" shouts the foreman, as several men try to throw him a line. However, he is quickly swept \ +under by the rolling waves and disappears from sight. + + +:: Old Shipwreck +<>\ +The Barrelman in the crows nest yells that he spotted a small vessle beached on a sandbar off the starboard side. \ +You bring your ship around and send out a small rowboat to investigate. + +Your men return saying the ship is abandoned and likely been there for several years. However, they recovered \ +several crates of fuel in water-tight barrels so you count your blessing. + + +:: Raft +<>\ +The Barrelman in the crows nest yells that he spotted a small raft on the horizon just ahead. As your ship approach \ +the raft you can make out the body of a man lying motionless across the bamboo raft. + +Your crew hoists the man up, and to your surprise he appears to be alive! Baddly sunburned and dehydrated he \ +can barely thank you before falling unconcious again. + +You send him below decks to recover. A few days and warm meals later his vigor had returned and he pledges \ +service to you for saving his life. + + +:: Friendly Port +<>\ +<>\ +<>\ +"Land Ho!" shouts the Barrelman, pointing to a dark spot on the horizon ahead. + +Your crew rejoices as you approach a small port town on this remote island. The port is friendly to the empire and \ +your ship is welcomed to the docks. While your crew enjoys some much needed shore-leave, you set about requesting \ +repairs and resupplies for your vessal. + +The workmen work quickly to patch any holes and repair the rigging. Fresh barrels of fuel are brought aboard. Even \ +a few young sailors looking for passage off the island signup to swell your ranks. diff --git a/src/main.tw b/src/main.tw index 284e3ad..87f3d36 100644 --- a/src/main.tw +++ b/src/main.tw @@ -3,9 +3,30 @@ Journey :: StoryData { + "ifid": "F76EC9DD-8B3B-43FE-A9F2-FA26005C9260", "format": "SugarCube", - "format-version": "2.31.1" + "format-version": "2.31.1", + "start": "Start", + "zoom": 1 } +:: StoryInit +<> +<> +<> +<> + :: Start -Hello World from Twine on Spindle! +/* Only send Start event when story is restarted */ +<> +<> + +:: PassageHeader +You are $distance leagues away from your destination. +---- + +:: PassageFooter +---- +Ship Hull: $hull/<> +Crew: $crew/<> souls +Fuel: $fuel/<> diff --git a/src/story.tw b/src/story.tw new file mode 100644 index 0000000..1c13a28 --- /dev/null +++ b/src/story.tw @@ -0,0 +1,111 @@ +:: Launch +Flags fly high, husbands and wives wave from the pier, and bells ring as your vessle, H.M.S Titus, \ +leaves Port Royal on its maiden voyage. + +Your ship is in tip-top shape and the crew is filled with joy and vigor. + +The task ahead of you is a simple but important one: Voyage to Isla De'muerta and deliver much \ +needed supplies and munitions to colony there. + +<> +[[Embark->Voyage]] + + +:: Voyage [nobr] +You are on your voyage! +
+
+<> +
+
+ +<> + <> + [[Onward!->Island]] +<> + [[No Fuel]] +<> + [[No Crew]] +<> + [[No Hull]] +<> + /* Update standard variables for each voyage step */ + <> + <> + <> + [[Onward!->Voyage]] +<> + + +:: Try Again +Your Voyage ends here. +<><><> + + +:: No Fuel +Your engines chug to a stop as the last bits of coal are used up. You and your men look around \ +at each other in despair as you realize you will likely starve or freeze before anyone can reach you. + +<>\ +<> + + +:: No Crew +You stand alone, captain of a derelict ship. All of your crew have been swallowed by the Sea \ +(or worse) and you are all that is left. It is impossible to run a ship this size alone. You \ +keep things running as long as you can, but eventually your stamina gives out. + +/* TODO: Add events here. (Hit a sandbar, sunk in a storm, pirates? etc) */\ +Drifting aimlessly at the sea winds' whim, you eventually feel a rough thud as your ship runs in \ +a long forgotten sandbar. The ship is beached permanently and it would take ten men to recover it. + +You feel so very tired. As you drift off to a final slumber, you wonder if another captain will \ +find your ship and make better use of your supplies. + +<>\ +<> + + +:: No Hull +Your ship creaks and groans under strain of holding itself together. Numerous gashes and \ +splintered boards dot the lower decks and you have been taking on water for some time. + +Finally the strain is too much and the aft section buckles, pulling the mast down with it. + +"Abbandon ship!" you shout, though it may be too late. Your crew scrambles to lower the \ +dingy and cram aboard. Some leaping to the water to swim for it. + +However, they say a Captain must go down with his ship. You remain aboard, sipping wine \ +as your crew rows into the distance and water slowly fills your cabin. + +<>\ +<> + + +:: Island +The sea is calm and the spies clear of clear of clouds. It is as if the sea knew how close \ +you were to journey's end it rewarded you with a brisk southernly wind pushing you onward. + +The Barrelman is the first to spot land on the horizon. + +"Land Ho!", he shouts triumphantly. + +Your navigator double checks his charts and confirms that you have at last arrived at your \ +final destination. Your crew rejoices and breaks out into a merry sea shanty. You can finally \ +relax and feel flush with relief as you stare at the steadily growing island on the horizon. + +[[Dock at Isle De'muerta->Win]] + + +:: Win +You land at Isla De'muerta and are greeted by the Harbormaster. He shakes your hand with much \ +enthusiasm, thanking you for your bravery and service to the Empire. + +Porters begin to unload your ship of it's precious supplies and cargo. + +You are treated to a find dinner in your honor by the Govenor of the island. + +You and your crew enjoy yourself for a time, but soon you feel the sea calling to you again. + +Will you set sail on another <><><> +<>