Sha256: 4045bb807f91f64819fff879039cff5a889b87f86120d284461d9287b9455e6b

Contents?: true

Size: 615 Bytes

Versions: 6

Compression:

Stored size: 615 Bytes

Contents

require 'pbox2d'
require 'forwardable'
require_relative 'lib/custom_listener'
require_relative 'lib/particle'
require_relative 'lib/boundary'

attr_reader :box2d, :particles, :wall

def settings
  size 400, 400
end

def setup
  sketch_title 'Test Contact'
  @box2d = WorldBuilder.build(app: self)
  box2d.add_listener(CustomListener.new)
  @particles = []
  @wall = Boundary.new(self, width / 2, height - 5, width, 10)
end

def draw
  background color('#ffffff')
  particles << Particle.new(self, rand(width), 20, rand(4..8)) if rand < 0.1
  particles.each(&:display)
  particles.reject!(&:done)
  wall.display
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pbox2d-1.0.3-java examples/test_contact/test_contact.rb
pbox2d-1.0.2-java examples/test_contact/test_contact.rb
pbox2d-1.0.1-java examples/test_contact/test_contact.rb
pbox2d-1.0.0-java examples/test_contact/test_contact.rb
pbox2d-0.9.1-java examples/test_contact/test_contact.rb
pbox2d-0.9.0-java examples/test_contact/test_contact.rb