Class: Town
- Inherits:
-
Object
- Object
- Town
- Defined in:
- lib/places.rb
Instance Method Summary collapse
- #choices ⇒ Object
-
#initialize ⇒ Town
constructor
A new instance of Town.
Constructor Details
#initialize ⇒ Town
Returns a new instance of Town.
8 9 10 11 12 13 14 |
# File 'lib/places.rb', line 8 def initialize # Town is only available as an option in the Dungeon (to return to) # initialize is only called the first time, so this greeting is only seen once puts "These things always start the same way and your adventure is no exception..." puts "You walk into town, scanning each nook and cranny. Most faces are friendly," puts "some are not..." end |
Instance Method Details
#choices ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/places.rb', line 16 def choices move = 0 until move == "3" begin load_data puts # formatting puts .yellow puts (@player.name, @player.xp, @player.lvl, @player.coin, @player.cur_hp, @player.cur_mana) puts .yellow puts # formatting c = Choice.new "Please choose where you will head next:", { "1" => "The Dungeon", "2" => "Ye Old Tavern", "3" => "Exit Game" } move = c.prompt end while not (move == "1" or move == "2" or move == "3") case when move == "1" Dungeon.new.choices when move == "2" Tavern.new.choices when move == "3" # save the player's stats before exit save_data exit end end end |