Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed bug when shooting on title screen

  • Loading branch information...
commit 3efbf176d94d2db43485f1cd7ad3ccc8036d2e71 1 parent 6e1a1c7
@apillet authored
Showing with 10 additions and 3 deletions.
  1. +10 −3 lib/game.rb
View
13 lib/game.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.