Sha256: b2b1902426665ce341545eb2fc2a9a1d8cfa8bb9c962ece9b7fe52e17326da36
Contents?: true
Size: 628 Bytes
Versions: 2
Compression:
Stored size: 628 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 col = color('#ffffff') background(col) 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pbox2d-0.8.0-java | examples/test_contact/test_contact.rb |
pbox2d-0.6.0-java | examples/test_contact/test_contact.rb |