Sha256: 66d291838cd0a09d5d377627f69a5ef74f6eadc2f8d419d1473851d4530980be

Contents?: true

Size: 572 Bytes

Versions: 11

Compression:

Stored size: 572 Bytes

Contents

# The Nature of Code
# Daniel Shiffman
# http://natureofcode.com

# Notice how we are using inheritance here!
# We could have just stored a reference to a VerletParticle object
# inside the Particle class, but inheritance is a nice alternative
class Particle < Physics::VerletParticle2D
  extend Forwardable
  def_delegators(:@app, :fill, :stroke, :ellipse)
  def initialize(loc)
    super(loc)
    @app = $app
  end

  # All we're doing really is adding a display function to a VerletParticle
  def display
    fill(175)
    stroke(0)
    ellipse(x, y, 16, 16)
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
toxiclibs-2.1.0 examples/soft_body/particle.rb
toxiclibs-2.0.0 examples/soft_body/particle.rb
toxiclibs-1.0.0 examples/soft_body/particle.rb
toxiclibs-0.9.3 examples/soft_body/particle.rb
toxiclibs-0.9.2 examples/soft_body/particle.rb
toxiclibs-0.9.1 examples/soft_body/particle.rb
toxiclibs-0.9.0 examples/soft_body/particle.rb
toxiclibs-0.8.0 examples/soft_body/particle.rb
toxiclibs-0.6.0-java examples/soft_body/particle.rb
toxiclibs-0.5.1-java examples/soft_body/particle.rb
toxiclibs-0.5.0-java examples/soft_body/particle.rb