Class: Rubygoal::Goal
- Inherits:
-
Object
- Object
- Rubygoal::Goal
- Defined in:
- lib/rubygoal/goal.rb
Instance Method Summary collapse
- #celebration_done? ⇒ Boolean
- #draw ⇒ Object
-
#initialize(game_window) ⇒ Goal
constructor
A new instance of Goal.
- #update(elapsed_time) ⇒ Object
Constructor Details
#initialize(game_window) ⇒ Goal
Returns a new instance of Goal.
7 8 9 10 11 |
# File 'lib/rubygoal/goal.rb', line 7 def initialize(game_window) @goal_image = Gosu::Image.new(game_window, Config.goal.image_file, true) @celebration_time = 0 end |
Instance Method Details
#celebration_done? ⇒ Boolean
13 14 15 |
# File 'lib/rubygoal/goal.rb', line 13 def celebration_done? ! end |
#draw ⇒ Object
17 18 19 20 |
# File 'lib/rubygoal/goal.rb', line 17 def draw position = Config.game.goal_image_position goal_image.draw(position.x, position.y, 1) end |
#update(elapsed_time) ⇒ Object
22 23 24 25 |
# File 'lib/rubygoal/goal.rb', line 22 def update(elapsed_time) start_celebration unless self.celebration_time -= elapsed_time end |