Class: Tmx::Object

Inherits:
Object
  • Object
show all
Defined in:
lib/tmx_ext/object.rb

Instance Method Summary collapse

Instance Method Details

#bodyObject

TODO: the mass and moment of interia should configurable through properties



6
7
8
# File 'lib/tmx_ext/object.rb', line 6

def body
  @body ||= CP::Body.new default_mass, default_moment_of_inertia
end

#shapeObject



10
11
12
13
14
15
16
17
18
# File 'lib/tmx_ext/object.rb', line 10

def shape
  @poly_shape ||= begin
    new_shape = CP::Shape::Poly.new(body,poly_vec2s,default_shape_attach_point)
    new_shape.collision_type = type.to_sym
    new_shape.e = default_elasticity
    new_shape.sensor = default_sensor
    new_shape
  end
end