Class: CollidableShape
- Inherits:
-
Object
- Object
- CollidableShape
- Defined in:
- lib/gamebox/behaviors/collidable/collidable_shape.rb
Direct Known Subclasses
Instance Attribute Summary (collapse)
-
- (Object) actor
Returns the value of attribute actor.
-
- (Object) cw_local_points
readonly
Returns the value of attribute cw_local_points.
-
- (Object) cw_world_edge_normals
readonly
Returns the value of attribute cw_world_edge_normals.
-
- (Object) cw_world_lines
readonly
Returns the value of attribute cw_world_lines.
-
- (Object) cw_world_points
readonly
Returns the value of attribute cw_world_points.
-
- (Object) opts
Returns the value of attribute opts.
-
- (Object) radius
Returns the value of attribute radius.
Instance Method Summary (collapse)
- - (Object) actor_x
- - (Object) actor_y
-
- (CollidableShape) initialize(actor, options)
constructor
A new instance of CollidableShape.
- - (Object) recalculate_collidable_cache
-
- (Object) setup
TODO find out if this is called.
- - (Object) width (also: #height)
Constructor Details
- (CollidableShape) initialize(actor, options)
A new instance of CollidableShape
6 7 8 9 10 11 12 13 14 |
# File 'lib/gamebox/behaviors/collidable/collidable_shape.rb', line 6 def initialize(actor, ) @opts = @actor = actor @x_offset = opts[:x_offset] @y_offset = opts[:y_offset] @x_offset ||= 0 @y_offset ||= 0 end |
Instance Attribute Details
- (Object) actor
Returns the value of attribute actor
2 3 4 |
# File 'lib/gamebox/behaviors/collidable/collidable_shape.rb', line 2 def actor @actor end |
- (Object) cw_local_points (readonly)
Returns the value of attribute cw_local_points
4 5 6 |
# File 'lib/gamebox/behaviors/collidable/collidable_shape.rb', line 4 def cw_local_points @cw_local_points end |
- (Object) cw_world_edge_normals (readonly)
Returns the value of attribute cw_world_edge_normals
4 5 6 |
# File 'lib/gamebox/behaviors/collidable/collidable_shape.rb', line 4 def cw_world_edge_normals @cw_world_edge_normals end |
- (Object) cw_world_lines (readonly)
Returns the value of attribute cw_world_lines
4 5 6 |
# File 'lib/gamebox/behaviors/collidable/collidable_shape.rb', line 4 def cw_world_lines @cw_world_lines end |
- (Object) cw_world_points (readonly)
Returns the value of attribute cw_world_points
4 5 6 |
# File 'lib/gamebox/behaviors/collidable/collidable_shape.rb', line 4 def cw_world_points @cw_world_points end |
- (Object) opts
Returns the value of attribute opts
2 3 4 |
# File 'lib/gamebox/behaviors/collidable/collidable_shape.rb', line 2 def opts @opts end |
- (Object) radius
Returns the value of attribute radius
2 3 4 |
# File 'lib/gamebox/behaviors/collidable/collidable_shape.rb', line 2 def radius @radius end |
Instance Method Details
- (Object) actor_x
16 17 18 |
# File 'lib/gamebox/behaviors/collidable/collidable_shape.rb', line 16 def actor_x @actor.x + @x_offset end |
- (Object) actor_y
20 21 22 |
# File 'lib/gamebox/behaviors/collidable/collidable_shape.rb', line 20 def actor_y @actor.y + @y_offset end |
- (Object) recalculate_collidable_cache
33 34 |
# File 'lib/gamebox/behaviors/collidable/collidable_shape.rb', line 33 def recalculate_collidable_cache end |
- (Object) setup
TODO find out if this is called
25 26 |
# File 'lib/gamebox/behaviors/collidable/collidable_shape.rb', line 25 def setup end |
- (Object) width Also known as: height
28 29 30 |
# File 'lib/gamebox/behaviors/collidable/collidable_shape.rb', line 28 def width @radius * 2 end |