Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ROFLCopters away!

  • Loading branch information...
commit 7020eeba4d3e648de87c814298caf3397c860569 1 parent 1133f10
@dhotson dhotson authored committed
Showing with 40 additions and 1 deletion.
  1. +40 −1 asc.rb
View
41 asc.rb
@@ -90,7 +90,7 @@ def initialize horizon
@building_generator = BuildingGenerator.new(self)
@player = Player.new(25)
@buildings = [ Building.new(-10, 30, 120) ]
- @misc = [ Scoreboard.new(self) ]
+ @misc = [ Scoreboard.new(self), RoflCopter.new(50, 4) ]
@speed = 4
@distance = 0
end
@@ -331,4 +331,43 @@ def char rx, ry, ticks
end
end
+class RoflCopter < Struct.new(:x, :y)
+ include Renderable
+ def initialize x, y
+ super
+ @frames = [
+ [
+ ' :LOL:ROFL:ROFL',
+ ' ^ ',
+ ' L /-------- ',
+ ' O === []\ ',
+ ' L \ \ ',
+ ' \__________] ',
+ ' I I ',
+ ' --------------/ ',
+ ],
+ [
+ 'ROFL:ROFL:LOL: ',
+ ' ^ ',
+ ' /-------- ',
+ ' LOL=== []\ ',
+ ' \ \ ',
+ ' \__________] ',
+ ' I I ',
+ ' --------------/ ',
+ ],
+ ]
+ end
+
+ def width; 23 end
+ def height; 8 end
+ def y; super + (5 * Math.sin(Time.new.to_f)).to_i end
+ def char rx, ry, ticks
+ @frames[ticks % 2][ry][rx]
+ rescue
+ " " # Roflcopter crashes from time to time..
+ end
+end
+
+
Game.new.run
Please sign in to comment.
Something went wrong with that request. Please try again.