Skip to content

Instantly share code, notes, and snippets.

@ruprict
Created February 3, 2012 01:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ruprict/1726974 to your computer and use it in GitHub Desktop.
Save ruprict/1726974 to your computer and use it in GitHub Desktop.
ROFLBALT Scoreboard and GameOverBanner
class Scoreboard
include Renderable
def initialize world
@world = world
end
def height; 3 end
def width; 20 end
def x; -18 end
def y; 1 end
def template
[
' ',
' Score: %9s ' % [ @world.distance],
' '
]
end
def pixel x, y, rx, ry, ticks
Pixel.new template[ry][rx], 244, 234
end
end
class GameOverBanner
FG = 16
BG = 244
include Renderable
def x; 28 end
def y; 14 end
def width; 28 end
def height; 3 end
def template
[
' ',
' YOU DIED. LOL. ',
' ',
]
end
def pixel x, y, rx, ry, ticks
Pixel.new template[ry][rx], FG, BG
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment