Class: Kawaii::PhysicsEntity

Inherits:
Entity show all
Defined in:
lib/kawaii/physics_entity.rb

Instance Attribute Summary collapse

Attributes inherited from Entity

#flipped_h, #flipped_v, #texture

Attributes inherited from Node

#children, #gravity, #position, #rotation, #static, #velocity

Instance Method Summary collapse

Methods inherited from Entity

#after_update, #before_update, #draw

Methods inherited from Node

#add_child, #count, #draw, #has_children?, #remove_child, #update

Constructor Details

#initialize(geom, args) ⇒ PhysicsEntity

Returns a new instance of PhysicsEntity.



8
9
10
11
12
13
14
15
16
# File 'lib/kawaii/physics_entity.rb', line 8

def initialize geom, args
	@geom = geom
	case geom
		when :circle
			create_circle(args[:radius])
		when :rectangle
			create_rectangle(args[:width], args[:height])
	end
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



6
7
8
# File 'lib/kawaii/physics_entity.rb', line 6

def body
  @body
end

#geomObject

Returns the value of attribute geom.



6
7
8
# File 'lib/kawaii/physics_entity.rb', line 6

def geom
  @geom
end

#shapeObject

Returns the value of attribute shape.



6
7
8
# File 'lib/kawaii/physics_entity.rb', line 6

def shape
  @shape
end

Instance Method Details

#add_to_space(chipmunk_space) ⇒ Object



18
19
20
# File 'lib/kawaii/physics_entity.rb', line 18

def add_to_space chipmunk_space
	# TODO: check if body is static etc...
end

#remove_from_space(chipmunk_space) ⇒ Object



22
23
# File 'lib/kawaii/physics_entity.rb', line 22

def remove_from_space chipmunk_space
end