jadehamel / StoryChoicesJs

Client-side customizable game where players create their own story through interactive choices.
1 stars 0 forks source link

StoryChoicesJs

Client-side customizable game where players create their own story through interactive choices.

Game Functionalities and User Interactions

JavaScript Functionalities:

Page Initialization (init):

Start Screen:

Game Loading:

Story Navigation:

Image Handling:

CSS Functionalities:

Global Styles:

Game Container:

Title Styling:

Button Styling:

Image Styling:

Start Screen:

Form Styling:

Detailed User Interactions:

Loading the Game:

Playing the Game:

Interacting with Images:

Button Interactions:

Setup

Getting Started

  1. Clone the Repository:

    git clone https://github.com/jadehamel/StoryChoicesJs.git
    cd your-choices-story
  2. Folder Structure:

    • Place your story's images in stories/{storyPath}/images/.
    • Create a JSON file named story.json in stories/{storyPath}/ to define your story's structure (details below).
    • Optionally, customize styles in stories/{storyPath}/style.css.
  3. Modify storychoices.js:

    Update the following variables in storychoices.js to match your story:

    const storyPath = "yourlover";  // Replace with your story folder name
    const mainCharacter = "Pineapple";  // Default player's name

    Solution for multiple stories in story/ Use the parameters story and/or player in url:

    • index.html?story=storyPath&player=myName
    • story=(customStoryPath) Replace with your story folder name
    • player=(customMainCharacter) Default player's name

Creating a New Story

To create a new story, follow these steps:

  1. Define Story Structure (story.json) or edit and rename template.json:

    {
     "title": "Your Story Title",
     "intro_stepname": "start",
     "people": [
       {"role": "{mainCharacter}", "name": "mainCharacter"}  // Placeholder for player's name
     ],
     "steps": {
       "start": {
         "text": "Once upon a time, {mainCharacter} woke up in a mysterious place...",
         "choices": [
           {"text": "Explore further", "next": "explore"},
           {"text": "Stay put", "next": "stay"}
         ]
       },
       "explore": {
         "text": "As {mainCharacter} ventured deeper, a strange figure appeared...",
         "choices": [
           {"text": "Approach the figure", "next": "approach"},
           {"text": "Run away", "next": "run"}
         ]
       },
       // Add more steps as needed
     },
     "img_types": ".jpg"  // Image file type
    }
    • Replace placeholders like {mainCharacter} with appropriate text.
  2. Add Images:

    • For each step in your story, place an image file in stories/{storyPath}/ named according to the step name (e.g., start.png, explore.jpg).
  3. Modify CSS (Optional):

    Customize styles in stories/{storyPath}/style.css to match your story's theme.

  4. Modify Soundrack (Optional):

    Use your own soundtrack.mp3 by replacing the file in the root path

Running the Game

Contributing

If you'd like to contribute to this project, fork the repository and submit a pull request. Your contributions are welcome!

Notes: