Class: CollidableShape

Inherits:
Object show all
Defined in:
lib/gamebox/behaviors/collidable/collidable_shape.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(actor, options) ⇒ CollidableShape

Returns 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, options)
  @opts = options
  @actor = actor

  @x_offset = opts[:x_offset]
  @y_offset = opts[:y_offset]
  @x_offset ||= 0
  @y_offset ||= 0
end

Instance Attribute Details

#actor ⇒ Object

Returns the value of attribute actor.



2
3
4
# File 'lib/gamebox/behaviors/collidable/collidable_shape.rb', line 2

def actor
  @actor
end

#cw_local_points ⇒ Object (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

#cw_world_edge_normals ⇒ Object (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

#cw_world_lines ⇒ Object (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

#cw_world_points ⇒ Object (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

#opts ⇒ Object

Returns the value of attribute opts.



2
3
4
# File 'lib/gamebox/behaviors/collidable/collidable_shape.rb', line 2

def opts
  @opts
end

#radius ⇒ Object

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

#actor_x ⇒ Object



16
17
18
# File 'lib/gamebox/behaviors/collidable/collidable_shape.rb', line 16

def actor_x
  @actor.x + @x_offset
end

#actor_y ⇒ Object



20
21
22
# File 'lib/gamebox/behaviors/collidable/collidable_shape.rb', line 20

def actor_y
  @actor.y + @y_offset
end

#recalculate_collidable_cache ⇒ Object



33
34
# File 'lib/gamebox/behaviors/collidable/collidable_shape.rb', line 33

def recalculate_collidable_cache
end

#setup ⇒ Object

TODO find out if this is called



25
26
# File 'lib/gamebox/behaviors/collidable/collidable_shape.rb', line 25

def setup
end

#width ⇒ Object Also known as: height



28
29
30
# File 'lib/gamebox/behaviors/collidable/collidable_shape.rb', line 28

def width
  @radius * 2
end