Class: RubyArmor::FloatingText
- Inherits:
-
GameObject
- Object
- GameObject
- RubyArmor::FloatingText
- Defined in:
- lib/ruby_armor/floating_text.rb
Constant Summary collapse
- FONT_SIZE =
20
Instance Method Summary collapse
- #draw ⇒ Object
-
#initialize(text, options = {}) ⇒ FloatingText
constructor
A new instance of FloatingText.
- #update ⇒ Object
Constructor Details
#initialize(text, options = {}) ⇒ FloatingText
Returns a new instance of FloatingText.
5 6 7 8 9 10 11 |
# File 'lib/ruby_armor/floating_text.rb', line 5 def initialize(text, = {}) super() @final_y = y - 60 @text = text @font = Font["ProggyCleanSZ.ttf", FONT_SIZE] end |
Instance Method Details
#draw ⇒ Object
18 19 20 |
# File 'lib/ruby_armor/floating_text.rb', line 18 def draw @font.draw_rel @text, x, y, zorder, 0.5, 0.5, 1, 1, color end |
#update ⇒ Object
13 14 15 16 |
# File 'lib/ruby_armor/floating_text.rb', line 13 def update self.y -= 1 # TODO: scale this with FPS. destroy if y < @final_y end |