Class: HighScoreScene

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

Constant Summary collapse

WIDTH =
10
HEIGHT =
20
BLOCK_SIZE =

pixels

20

Instance Attribute Summary

Attributes inherited from Scene

#window

Instance Method Summary collapse

Methods inherited from Scene

#update

Constructor Details

#initialize(window) ⇒ HighScoreScene

Returns a new instance of HighScoreScene.



156
157
158
159
160
# File 'lib/scene.rb', line 156

def initialize(window)
  super(window)
  @list = [0]

end

Instance Method Details

#add_score(score) ⇒ Object



162
163
164
165
# File 'lib/scene.rb', line 162

def add_score(score)
  @list.append(score)
  @list = @list.sort.reverse
end

#button_down(id) ⇒ Object



167
168
169
# File 'lib/scene.rb', line 167

def button_down(id)
  @window.menu if id == Gosu::KB_ESCAPE
end

#drawObject



171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/scene.rb', line 171

def draw

  i = 1
  x = 150
  y = 10
  @list.each do |l|
    @window.font.draw_text("#{i}. #{l}", x, y, ZOrder::UI, 1.0, 1.0, Gosu::Color::YELLOW)
    i += 1
    y += 50
    return if i >= 10
  end

end