Class: GameOver

Inherits:
Object
  • Object
show all
Defined in:
lib/game_over.rb

Instance Method Summary collapse

Constructor Details

#initialize(window, death_toll) ⇒ GameOver

Returns a new instance of GameOver.



2
3
4
5
6
# File 'lib/game_over.rb', line 2

def initialize(window, death_toll)
  @window = window
  @font = Gosu::Font.new(@window, Gosu::default_font_name, 20)
  @death_toll = death_toll
end

Instance Method Details

#button_down(id) ⇒ Object



14
15
16
# File 'lib/game_over.rb', line 14

def button_down(id)
  Processor.close if id == Gosu::KbEscape
end

#drawObject



8
9
10
11
12
# File 'lib/game_over.rb', line 8

def draw
  @font.draw('It is a draw, both players died', 200, 200, 1) if draw?
  @font.draw("Player 2 won. Player 1 was blown up by #{killer(:player_0)}", 200, 200, 1) if player_0_hit?
  @font.draw("Player 1 won. Player 2 was blown up by #{killer(:player_1)}", 200, 200, 1) if player_1_hit?
end

#updateObject



18
19
20
# File 'lib/game_over.rb', line 18

def update
  # do nothing
end