Sha256: 75f54d5ced7923f9a46e0e1615d476001cbbd9e3706fad3243a0a4fc40e69adc
Contents?: true
Size: 481 Bytes
Versions: 9
Compression:
Stored size: 481 Bytes
Contents
require 'forwardable' # The Nature of Code # Daniel Shiffman # http://natureofcode.com class Attractor < Physics::VerletParticle2D extend Forwardable def_delegators(:@app, :fill, :ellipse, :physics, :width) attr_accessor :r def initialize(loc) super(loc) @app = $app @r = 24 physics.add_particle(self) physics.add_behavior(Physics::AttractionBehavior2D.new(self, width, 0.1)) end def display fill(0) ellipse(x, y, r * 2, r * 2) end end
Version data entries
9 entries across 9 versions & 1 rubygems