Class: Zarta::StartScreen
- Inherits:
-
Object
- Object
- Zarta::StartScreen
- Defined in:
- lib/zarta/main.rb
Instance Method Summary collapse
-
#initialize(dungeon) ⇒ StartScreen
constructor
A new instance of StartScreen.
- #leaderboard ⇒ Object
- #load_game ⇒ Object
- #new_game ⇒ Object
- #show_splash ⇒ Object
Constructor Details
#initialize(dungeon) ⇒ StartScreen
Returns a new instance of StartScreen.
39 40 41 42 43 44 |
# File 'lib/zarta/main.rb', line 39 def initialize(dungeon) @dungeon = dungeon @prompt = TTY::Prompt.new @pastel = Pastel.new show_splash end |
Instance Method Details
#leaderboard ⇒ Object
77 78 79 80 |
# File 'lib/zarta/main.rb', line 77 def leaderboard puts 'Leaderboard not implemented yet...' gets end |
#load_game ⇒ Object
72 73 74 75 |
# File 'lib/zarta/main.rb', line 72 def load_game puts 'Load Game not implemented yet...' gets end |
#new_game ⇒ Object
66 67 68 69 70 |
# File 'lib/zarta/main.rb', line 66 def new_game player_name = @prompt.ask("What's your name, adventurer?", required: true) @dungeon.player.name = player_name Zarta::Screen.new(@dungeon) end |
#show_splash ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/zarta/main.rb', line 46 def show_splash loop do system 'clear' a = Artii::Base.new font: 'isometric3' title = a.asciify('Zarta') puts @pastel.red.bold(title) splash_option = @prompt.select('') do || .choice 'New Game' .choice 'Load Game' .choice 'Leaderboards' .choice 'Quit' end new_game if splash_option == 'New Game' load_game if splash_option == 'Load Game' leaderboard if splash_option == 'Leaderboards' exit[0] if splash_option == 'Quit' && @prompt.yes?('Are you sure?') end end |