Class: GamesAndRpgParadise::MazePuzzle::CLI

Inherits:
Object
  • Object
show all
Includes:
Commander::Methods
Defined in:
lib/games_and_rpg_paradise/gui/gosu/maze_puzzle/cli.rb

Overview

For now there are three game mode:

1 is classic
2 is multiplayer
3 is anoying friend

Instance Method Summary collapse

Instance Method Details

#runObject



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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/games_and_rpg_paradise/gui/gosu/maze_puzzle/cli.rb', line 20

def run
  @full_screen = false

  program :name, MazePuzzle::Configuration::PROGRAM_NAME 
  program :version, MazePuzzle::VERSION
  program :description, MazePuzzle::Configuration::DESCRIPTION 

  default_command :classic

  global_option('-f', '--fullscreen', 'Render window at full screen') {
    @full_screen = true
  }

  command(:classic) { |c|
    c.syntax = 'a_maze_ing classic [options]'
    c.description = 'Classic mode, difficulty increase with level'
    c.action do 
      # the second parameter is game mode 
      MazePuzzle::GameWindow.new(@full_screen,1).show
    end
  }

  command :multiplayer do |c|
    c.syntax = 'a_maze_ing multiplayer [options]'
    c.description = 'Multiplayer mode, two player race to the gate, player 2 use W/S/A/D key to move up/down/left/right'
    c.action { 
      MazePuzzle::GameWindow.new(@full_screen,2).show
    }
  end
  alias_command :'m', :multiplayer

  command :annoying_friend do |c|
    c.syntax = 'a_maze_ing anfri [options]'
    c.description = 'Annoying friend mode, player 1 try to get to the gate while the player 2(annoying friend) try to catch him'
    c.action { 
      MazePuzzle::GameWindow.new(@full_screen,3).show
    }
  end
  alias_command :'af', :annoying_friend, :'anfri', :'multiplayer2', :'multiplayer_2'
  run!
end