public
Created

ROFLBALT RoflCopter

  • Download Gist
gistfile1.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
class RoflCopter
include Renderable
def initialize x, y, background
@x, @y = x, y
@background = background
@frames = [
[
' :LoL:ROFL:ROFL',
' L ____|__ ',
' O ===` []\ ',
' L \________] ',
' .__|____|__/ ',
],
[
' ROFL:ROFL:LoL: ',
' ____|__ ',
' LOL===` []\ ',
' \________] ',
' .__|____|__/ ',
],
]
end
def width; 24 end
def height; 5 end
def y
range = 1.5
@y + (range * Math.sin(Time.new.to_f * 1.5)).round
end
def x
range = 20
@x + (range * Math.sin(Time.new.to_f * 0.7)).round
end
def pixel x, y, rx, ry, ticks
Pixel.new char(rx, ry, ticks), 246, @background.color(x, y)
end
def char rx, ry, ticks
@frames[ticks % 2][ry][rx] || " "
rescue
" " # Roflcopter crashes from time to time..
end
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.