Permalink
Browse files

Fixed bug when shooting on title screen

  • Loading branch information...
1 parent 6e1a1c7 commit 3efbf176d94d2db43485f1cd7ad3ccc8036d2e71 @apillet committed Mar 14, 2011
Showing with 10 additions and 3 deletions.
  1. +10 −3 lib/game.rb
View
@@ -108,11 +108,18 @@ def draw_lives
def button_down(id)
close if id == Gosu::KbQ
-
- if id == Gosu::KbSpace
- @projectiles << @player.shoot unless @projectiles.size >= 5
+ shoot if id == Gosu::KbSpace
+ end
+
+ def shoot
+ if can_shoot?
+ @projectiles << @player.shoot
end
end
+
+ def can_shoot?
+ @game_in_progress && @projectiles.size < 5
+ end
def control_player
if button_down? Gosu::KbLeft

0 comments on commit 3efbf17

Please sign in to comment.