abduzziwa / Simple-Adventur-CLI-Game

Simpe school project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adventure Game..#Simpe school project..

Parsing/Explanation: Hey there! So, I've got this cool piece of code here that I want to walk you through. It's for a text-based treasure hunt game, and it's written in JavaScript. Let's dive in!

First off, we've got some imports and variable declarations. We're using the readline module to handle input from the command line, and inquirer for interactive prompts. Then, there are these awesome ASCII art pieces for visual effects. Pretty neat, right?

Next up, we've got some metadata in the author variable. It's just some info about me as the author of the game, the date it was created, and some contact details in case anyone wants to chat about it.

Now, let's get to the meat of the game - the story object. This is where the magic happens! It defines the different paths and outcomes of the game. Each path has a message to display to the player and options for the player to choose from. Depending on the player's choices, they either win or lose the game.

Finally, we've got the playStory function. This function is the heart of the game. It takes a part parameter to determine which part of the story to play. It displays the current message, presents the available options, and then waits for the player's input. Based on the player's choice, it continues to the next part of the story until the game reaches a win or lose condition.

And that's pretty much it! The last line playStory("start") kicks off the game by starting from the beginning of the story. So, grab your explorer hat and get ready for an adventure in the jungle!

About

Simpe school project


Languages

Language:JavaScript 100.0%