Class: Rubygoal::Ball
Constant Summary
Constants included
from Moveable
Moveable::MIN_DISTANCE
Instance Attribute Summary
Attributes included from Moveable
#position, #velocity
Instance Method Summary
collapse
Methods included from Moveable
#distance, #move_to, #moving?
Constructor Details
#initialize(window, position) ⇒ Ball
Returns a new instance of Ball.
10
11
12
13
14
|
# File 'lib/rubygoal/ball.rb', line 10
def initialize(window, position)
super()
@position = position
@image = Gosu::Image.new(window, Config.ball.image_file, false)
end
|
Instance Method Details
#draw ⇒ Object
20
21
22
|
# File 'lib/rubygoal/ball.rb', line 20
def draw
image.draw(position.x - Config.ball.width / 2, position.y - Config.ball.height / 2, 1)
end
|
#goal? ⇒ Boolean
16
17
18
|
# File 'lib/rubygoal/ball.rb', line 16
def goal?
FieldMetrics.goal?(position)
end
|