Class: Particle
- Inherits:
-
Object
- Object
- Particle
- Includes:
- HasSprite
- Defined in:
- lib/rubysketch/solitaire/common/particle.rb
Instance Attribute Summary collapse
-
#sprites ⇒ Object
readonly
Returns the value of attribute sprites.
Instance Method Summary collapse
- #delete(sprite) ⇒ Object
- #draw ⇒ Object
-
#initialize ⇒ Particle
constructor
A new instance of Particle.
- #new(x, y, w, h, &block) ⇒ Object
Methods included from HasSprite
Constructor Details
#initialize ⇒ Particle
Returns a new instance of Particle.
8 9 10 11 |
# File 'lib/rubysketch/solitaire/common/particle.rb', line 8 def initialize() @sprites = [] @pool = [] end |
Instance Attribute Details
#sprites ⇒ Object (readonly)
Returns the value of attribute sprites.
13 14 15 |
# File 'lib/rubysketch/solitaire/common/particle.rb', line 13 def sprites @sprites end |
Instance Method Details
#delete(sprite) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/rubysketch/solitaire/common/particle.rb', line 23 def delete(sprite) @sprites.delete sprite removeSprite sprite @pool.push sprite sprite end |
#draw ⇒ Object
30 31 32 |
# File 'lib/rubysketch/solitaire/common/particle.rb', line 30 def draw() drawSprite @sprites end |
#new(x, y, w, h, &block) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/rubysketch/solitaire/common/particle.rb', line 15 def new(x, y, w, h, &block) sp = newSprite x, y, w, h addSprite sp @sprites.push sp block.call sp if block sp end |