Created
October 12, 2015 19:11
-
-
Save allolex/e77eb931cebdf2aaae41 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Print out a list of actions | |
| def ask_action choices | |
| puts "\n\nWhat do you want to do?" | |
| puts choices | |
| gets.chomp.downcase | |
| end | |
| def print_description(desc) | |
| puts desc.gsub(/(?<=\A|\n)[ ]{2,}/,"") | |
| end | |
| def starting_scene | |
| print_description <<-EOP | |
| You see a tiny speck of light, which grows into a blinding glare. | |
| You hear voices. At first, they make no sense, but slowly you pick out ones familiar to you. | |
| You're in the company of THE JOKER, and he appears to have some friends with him. | |
| They think you're dead. | |
| EOP | |
| choices = [ | |
| "(C)ontinue to play dead.", | |
| "(G)et up." | |
| ] | |
| case ask_action(choices) | |
| when "c" | |
| print_description <<-EOP | |
| The prisoners pick you up and put you in | |
| the incinerator. | |
| Now you don't have to *play* dead. | |
| EOP | |
| when "g" | |
| smiling_joker | |
| else | |
| bad_choice | |
| starting_scene | |
| end | |
| end | |
| def bad_choice | |
| puts <<-EOP | |
| XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | |
| XX XX | |
| XX Choose one of the menu options XX | |
| XX XX | |
| XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | |
| EOP | |
| end | |
| def smiling_joker | |
| print_description <<-EOP | |
| You rise slowly to your feet. | |
| THE JOKER is looking right at you, smiling. | |
| EOP | |
| choices = [ | |
| "(A)ttack the Joker.", | |
| "(R)un away.", | |
| "(T)ackle the prisoners." | |
| ] | |
| case ask_action(choices) | |
| when "a" | |
| puts "KA-Pow!" | |
| when "r" | |
| puts "You trip over you cape and fall to your death." | |
| when "t" | |
| puts "Bam!! KO!!" | |
| else | |
| bad_choice | |
| smiling_joker | |
| end | |
| end | |
| def game_over | |
| puts "Game Over" | |
| end | |
| def start_game | |
| starting_scene | |
| game_over | |
| end | |
| start_game | |
| __END__ | |
| # Batman REPL Game | |
| - Setting | |
| - Arkham Asylum | |
| - Main Hall | |
| - other stuff | |
| - Enemies are: | |
| - Joker | |
| - Patients/Prisoners | |
| - Scarecrow | |
| - Poison Ivy | |
| - Batman starts off in main Hall | |
| The game starts off with Batman in the Main Hall. | |
| Description | |
| Actions |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment