Sha256: 8b762fa2dae851de01f303cc2bde7379af5f5e9ba44e35f9aa0343bc55d57577
Contents?: true
Size: 575 Bytes
Versions: 1
Compression:
Stored size: 575 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 setup size 400, 400 @box2d = Box2D.new(self) box2d.create_world 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pbox2d-0.4.2-java | examples/test_contact/test_contact.rb |