Class: PopupText
- Inherits:
-
Chingu::GameObject
- Object
- Chingu::GameObject
- PopupText
- Defined in:
- lib/prkwars/popuptext.rb
Overview
Class used for messages that pop up on the screen whenever something relevant happens - e.g. score goes up.
Instance Method Summary collapse
-
#initialize(message, x, y, options = {}) ⇒ PopupText
constructor
A new instance of PopupText.
- #update ⇒ Object
Constructor Details
#initialize(message, x, y, options = {}) ⇒ PopupText
Returns a new instance of PopupText.
10 11 12 13 14 15 16 |
# File 'lib/prkwars/popuptext.rb', line 10 def initialize(, x, y, = {}) super() @velocity_x = 0 @velocity_y = -2 @msg = Chingu::Text.create(, x: x, y: y, size: 30) end |
Instance Method Details
#update ⇒ Object
18 19 20 21 22 |
# File 'lib/prkwars/popuptext.rb', line 18 def update @msg.y -= 1 @msg.color.alpha -= 4 @msg.destroy! if color.alpha.zero? end |