Class: Tmx::ObjectShape::CircularShape
- Inherits:
-
Object
- Object
- Tmx::ObjectShape::CircularShape
show all
- Includes:
- ShapeDefaults
- Defined in:
- lib/tmx_ext/object_shape.rb
Instance Method Summary
collapse
#default_elasticity, #default_sensor, #default_shape_attach_point
Instance Method Details
#match?(object) ⇒ Boolean
56
57
58
59
|
# File 'lib/tmx_ext/object_shape.rb', line 56
def match?(object)
object.contents['shape'] == 'ellipse'
end
|
#shape(object) ⇒ Object
61
62
63
64
65
66
67
68
69
|
# File 'lib/tmx_ext/object_shape.rb', line 61
def shape(object)
radius = object.width / 2
offset = CP::Vec2.new(0,0)
new_shape = CP::Shape::Circle.new(object.body, radius, offset)
new_shape.collision_type = object.type.to_sym
new_shape.e = default_elasticity
new_shape.sensor = default_sensor
new_shape
end
|