Sha256: 2639d80498b3ec21447cb4f64e26675465a34cfab81b065bd6167990b33be08b

Contents?: true

Size: 507 Bytes

Versions: 1

Compression:

Stored size: 507 Bytes

Contents

# A Box class, note how to access class ParticleGroupDef in jruby
# which is imported into the PB module and not into global namespace
# mainly because of probable name conflict with ParticleSystem
class Box
  attr_accessor :pg
  def initialize(b2d, x, y)
    w = rand(1..3)
    h = rand(1..3)
    shape = PolygonShape.new
    pos = b2d.processing_to_world(x, y)
    shape.setAsBox(w, h, pos, 0)
    pd = PB::ParticleGroupDef.new
    pd.shape = shape
    @pg = b2d.world.create_particle_group(pd)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pbox2d-0.4.2-java examples/lib/box.rb