Class: Upgrade
- Inherits:
-
GameObject
- Object
- GameObject
- Upgrade
- Defined in:
- lib/entities/upgrade.rb
Overview
class Upgrade
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Attributes inherited from GameObject
Instance Method Summary collapse
- #done? ⇒ Boolean
-
#initialize(x, y, type) ⇒ Upgrade
constructor
A new instance of Upgrade.
- #taken(_obj) ⇒ Object
- #update ⇒ Object
Methods inherited from GameObject
#collide?, #collision_detect, #draw, #hitted, #solid?
Constructor Details
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
5 6 7 |
# File 'lib/entities/upgrade.rb', line 5 def type @type end |
Instance Method Details
#done? ⇒ Boolean
24 25 26 |
# File 'lib/entities/upgrade.rb', line 24 def done? @taken || @lifetime == 0 end |
#taken(_obj) ⇒ Object
15 16 17 |
# File 'lib/entities/upgrade.rb', line 15 def taken(_obj) @taken = true end |
#update ⇒ Object
19 20 21 22 |
# File 'lib/entities/upgrade.rb', line 19 def update @lifetime -= 1 if @lifetime > 0 @sprite.update end |