Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wlin114AdventureGame #12

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
# Choose Your Own Adventure
#My Adventure

Create a [Choose Your Own Adventure](http://en.wikipedia.org/wiki/Choose_Your_Own_Adventure#Format) game. [Here](https://writer.inklestudios.com/stories/musgraveritual) is a fancy web-based example, but creating yours as text-only, command-line based is fine. You can use ASCII art if you're feeling...wait for it...*adventurous*.

![cookie monster](http://media.giphy.com/media/5wWf7GXcEM6fJRAzUo8/giphy.gif)

See the [asciiart](https://github.com/nodanaonlyzuul/asciiart) and [artii](https://github.com/miketierney/artii) gems.

Submit a pull request to this repository with all the necessary files, and replace this README with a description of your game and how to run it. Make sure to give the user instructions in the game about how to play, get help, etc.
Run the myGame.py from terminal and enjoy!!
106 changes: 106 additions & 0 deletions myGame.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
def terminator()
abort('You are dead!')
end

def choose()
ans = gets.chomp
while ans!= "1" and ans!= "2" and ans!= "3"
puts "please enter a proper number"
ans = gets.chomp
end
return ans.to_i
end
def rooftop()
puts "You go up to the rooftop and lock the door."
puts "what do you want to do?"
puts "1. Make an S.O.S pattern using your clothes 2. Burn your clothes using the lighter in your pocket 3. There is no zombie on the ground! Let's JUMMMMMMMMMMP!"
ans = choose
if ans == 1
puts "Your clothes are blowing away and the zombie come up find you!"
terminator
end
if ans == 2
puts "Forgot to tell you that it is 10m above the ground!!"
terminator
end
puts "A helicopter finds you!"
abort("Your are survived")
end

def thirdflood()
puts "There are three class rooms in this floor."
puts "You can only go to one room because you don't have enough time!"
puts "1. music classroom 2. Library 3. GYM"
ans = choose
if ans == 1
puts "You find your music teacher! But a zombie music teacher"
terminator
end
if ans == 2
puts "Wow!!! You find the portal!!!"
abort("You are survived!!")
end
puts "You find nothing in the GYM and the zombie is approaching!"
rooftop
end

def hallway()
puts "The restroom is in front of you. Staircase is at the left side and elevator is at the right hand side."
puts "Where do you run?"
puts "1. restroom 2. staircase 3. elevator"
ans = choose
if ans == 1
puts "It is a dead end! You have no way to flee!"
terminator
end
if ans == 2
thirdflood()
end
puts "Zombies are taking over this city! It is black out everywhere!"
terminator
end

def school()
puts "A group of zombie see you and they want some fresh meat!"
puts "Where do you run?"
puts "1. left 2. right 3. go back to the building"
ans = choose
if ans == 1 or ans == 2
puts "You just sprain your leg. You can't run faster than zombie!"
terminator
end
puts "You step back into the building."
hallway()
end

def classroom()
puts "You are in the classroom and a zombie is wandering outside of the room."
puts "What do you going to do?"
puts "1. Hide behind the table 2. Run from the back door 3. Jump out of the window"
ans = choose
if ans == 1
puts "The zombie smells u out!"
puts "You have to do something quickly!"
puts "1. Try to kill the zombie 2. Run from the back door 3. Jump out of the window"
ans = choose
if ans == 1
puts "You are bitten by the zombie"
terminator
end
end
if ans == 2
hallway()
end
puts "You jump out from second floor and fall on the grass"
school()
end

def gameStart()
puts
puts "The end of the world..."
puts
print "Press *Enter* to continue..."
gets.chomp
classroom()
end
gameStart()