Class: Scoreboard

Inherits:
Object
  • Object
show all
Includes:
Renderable
Defined in:
lib/roflbalt.rb

Instance Method Summary collapse

Methods included from Renderable

#each_pixel, #right_x

Constructor Details

#initialize(world) ⇒ Scoreboard

Returns a new instance of Scoreboard.



398
399
400
# File 'lib/roflbalt.rb', line 398

def initialize world
  @world = world
end

Instance Method Details

#heightObject



401
# File 'lib/roflbalt.rb', line 401

def height; 3 end

#pixel(x, y, rx, ry, ticks) ⇒ Object



412
413
414
# File 'lib/roflbalt.rb', line 412

def pixel x, y, rx, ry, ticks
  Pixel.new template[ry][rx], 244, 234
end

#templateObject



405
406
407
408
409
410
411
# File 'lib/roflbalt.rb', line 405

def template
  [
    '                    ',
    '  Score: %9s  ' % [ @world.distance],
    '                    '
  ]
end

#widthObject



402
# File 'lib/roflbalt.rb', line 402

def width; 20 end

#xObject



403
# File 'lib/roflbalt.rb', line 403

def x; -18 end

#yObject



404
# File 'lib/roflbalt.rb', line 404

def y; 1 end