the_game.rb
1 # THE_GAME.rb 2 # 3 # Holds all the code for the game. 4 5 require "io/console" 6 require "rainbow/refinement" 7 using Rainbow 8 9 # Player Functions {{ 10 11 def give_player_item(item="") 12 if $playerinventory[:items].length < $playerinventory[:itemlimit] 13 $playerinventory[:items] << item 14 aoran = "a" 15 16 if item.downcase.start_with?("a", "e", "i", "o", "u") 17 aoran = "an" 18 end 19 20 puts "You got #{aoran} #{item.green}!" 21 else 22 puts "Your inventory is full! You cannot take the #{item.green}." 23 return false 24 end 25 26 true 27 end 28 29 # game over handler 30 def player_died_lol(reason="You suck lol.", tip="") 31 cls 32 puts "GAME OVER".bold.red 33 puts 34 puts "Reason: #{reason}".green 35 puts 36 if tip != "" 37 puts "TIP: #{tip}".blue 38 puts 39 end 40 puts "Would you like to try again? (If" + " NO ".bold + "is selected, the game will close.)" 41 puts 42 guh = choice "", %w[y n] 43 44 puts 45 if guh == "y" 46 puts "placehold" 47 else 48 puts "Alrighty then." 49 puts 50 pause 51 exit 52 end 53 end 54 55 # spawnism people think this is possible irl, it aint lol 56 def respawn 57 load_game 58 # add map handler when that function is added 59 end 60 61 # }} 62 63 # Story Functions {{ 64 65 def game_intro 66 cls 67 puts "Today, you recieved a message from your friends group chat." 68 puts "One of your friends was getting a pizza party started since everyone was graduating from High School." 69 puts "Of course, you wanted to join the fun, and also wanted to help start it, so you went to their house to help." 70 puts 71 pause 72 puts 73 puts "2 hours have past, and the party almost ready. A couple other friends have came early to help as well." 74 puts "You are currently chilling on a couch, when your friend Jake, the one who came up with the party, walks up to you." 75 puts 76 pause 77 puts 78 puts "Jake: Hey, can you help me with something?" 79 puts "#$playername: What's up?" 80 puts "Jake: There's some board games down in the basement, can you get some?" 81 puts "#$playername: Sure!" 82 puts 83 pause 84 puts 85 puts "You stand up, but then Jake stops you before you can move..." 86 puts 87 pause 88 puts 89 puts "Jake: Be careful down there, I saw something weird down there." 90 puts "#$playername: Dude, you are not gonna scare me, it'll be fine." 91 puts 92 pause 93 puts "" 94 puts "thats it lol" 95 puts 96 pause 97 end 98 99 # }}