Class: RubyFighter::Game
- Inherits:
-
Gosu::Window
- Object
- Gosu::Window
- RubyFighter::Game
- Defined in:
- lib/ruby_fighter/game.rb
Instance Method Summary collapse
- #button_down(id) ⇒ Object
- #button_down?(char) ⇒ Boolean
- #button_up(id) ⇒ Object
- #draw ⇒ Object
-
#initialize ⇒ Game
constructor
A new instance of Game.
- #update ⇒ Object
Constructor Details
#initialize ⇒ Game
Returns a new instance of Game.
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/ruby_fighter/game.rb', line 4 def initialize super(768, 480, false) self.caption = "Ruby Fighter" @backdrop = Backdrop.new(self, "background-1.jpg") @player1 = Player.new(self, "ryu", false) @player2 = Player.new(self, "chun-li", true) @controls1 = Controls.new(self, @player1, 1) @controls2 = Controls.new(self, @player2, 2) end |
Instance Method Details
#button_down(id) ⇒ Object
29 30 31 32 |
# File 'lib/ruby_fighter/game.rb', line 29 def (id) @controls1. (id) @controls2. (id) end |
#button_down?(char) ⇒ Boolean
39 40 41 |
# File 'lib/ruby_fighter/game.rb', line 39 def (char) super (char) end |
#button_up(id) ⇒ Object
34 35 36 37 |
# File 'lib/ruby_fighter/game.rb', line 34 def (id) @controls1. (id) @controls2. (id) end |
#draw ⇒ Object
17 18 19 20 21 22 |
# File 'lib/ruby_fighter/game.rb', line 17 def draw @backdrop.draw @player1.draw @player2.draw end |
#update ⇒ Object
24 25 26 27 |
# File 'lib/ruby_fighter/game.rb', line 24 def update @controls1.update 0, @player2.left @controls2.update @player1.right, width end |