Class: ParticleSprite
- Inherits:
-
Sprite
- Object
- Sprite
- ParticleSprite
- Defined in:
- lib/rubysketch/solitaire/common/particle.rb
Instance Attribute Summary collapse
-
#alpha ⇒ Object
Returns the value of attribute alpha.
-
#rgb ⇒ Object
Returns the value of attribute rgb.
Instance Method Summary collapse
- #delete ⇒ Object
- #frame=(frame) ⇒ Object
-
#initialize(owner, *args, rgb: [255], alpha: 255, **kwargs, &block) ⇒ ParticleSprite
constructor
A new instance of ParticleSprite.
Constructor Details
#initialize(owner, *args, rgb: [255], alpha: 255, **kwargs, &block) ⇒ ParticleSprite
Returns a new instance of ParticleSprite.
51 52 53 54 55 56 57 58 |
# File 'lib/rubysketch/solitaire/common/particle.rb', line 51 def initialize(owner, *args, rgb: [255], alpha: 255, **kwargs, &block) @owner, @rgb, @alpha = owner, rgb, alpha super(*args, **kwargs, &block) draw do |&draw| fill *@rgb, @alpha draw.call end end |
Instance Attribute Details
#alpha ⇒ Object
Returns the value of attribute alpha.
60 61 62 |
# File 'lib/rubysketch/solitaire/common/particle.rb', line 60 def alpha @alpha end |
#rgb ⇒ Object
Returns the value of attribute rgb.
60 61 62 |
# File 'lib/rubysketch/solitaire/common/particle.rb', line 60 def rgb @rgb end |
Instance Method Details
#delete ⇒ Object
67 68 69 |
# File 'lib/rubysketch/solitaire/common/particle.rb', line 67 def delete() @owner.delete self end |
#frame=(frame) ⇒ Object
62 63 64 65 |
# File 'lib/rubysketch/solitaire/common/particle.rb', line 62 def frame=(frame) self.pos = frame[0, 2] self.size = frame[2, 2] end |