Permalink
Browse files

fix joystick input.

  • Loading branch information...
TimothyFitz committed Jan 28, 2012
1 parent c6b9ddb commit b278c0e5a83b370972eb10451b1fbcb22f250c83
Showing with 5 additions and 5 deletions.
  1. +5 −5 main.py
View
10 main.py
@@ -212,10 +212,6 @@ def start_screen_visible():
return last_game_over is not None and steps - last_game_over > GAME_OVER_FRAMES
while not done:
- if joy.state.hats:
- hx, hy = joy.state.hats[0]
- move_player(player, hx, hy)
-
keys = pygame.key.get_pressed()
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)
glColor3f(1,1,1)
@@ -372,6 +368,10 @@ def start_screen_visible():
gun.step()
laser.step()
+ if joy.state.hats:
+ hx, hy = joy.state.hats[0]
+ move_player(player, hx, hy)
+
if keys[pygame.K_RIGHT]:
move_player(player, 1, 0)
elif keys[pygame.K_LEFT]:
@@ -382,7 +382,7 @@ def start_screen_visible():
elif keys[pygame.K_DOWN]:
move_player(player, 0, -1)
- if start_screen_visible() and keys[pygame.K_RETURN] and (player.health <= 0 or boss.health <= 0):
+ if start_screen_visible() and (keys[pygame.K_RETURN] or joy.state.buttons and joy.state.buttons[7]) and (player.health <= 0 or boss.health <= 0):
player.health = 100.
boss.health = 100.
last_game_over = None

0 comments on commit b278c0e

Please sign in to comment.