From 2dc75afd2c6b01a9d9aa419234157330d8eb172f Mon Sep 17 00:00:00 2001 From: Leah Alpert Date: Sun, 28 Aug 2011 23:33:55 -0700 Subject: Reset input queue at start of each game --- ddrinput.py | 6 +++++- tetris.py | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ddrinput.py b/ddrinput.py index a1bf482..19966d8 100644 --- a/ddrinput.py +++ b/ddrinput.py @@ -1,4 +1,5 @@ import pygame + JOY_EVENT = 7 KEY_EVENT = 2 X = 0 @@ -45,7 +46,10 @@ class DdrInput(object): for i in range(totaljoy): m = pygame.joystick.Joystick(i) m.init() - + + def reset(self): + pygame.event.clear() + def poll(self): """ Returns a tuple of player index (0 or 1) and move, diff --git a/tetris.py b/tetris.py index fd67ae2..64b3eed 100644 --- a/tetris.py +++ b/tetris.py @@ -217,6 +217,7 @@ class TetrisGame(object): self.board_animation(0,"up_arrow") self.board_animation(1,"up_arrow") self.start_time = None + self.input.reset() self.update_gui() self.handle_input() #this calls all other functions, such as add_player, start_game -- cgit v1.2.3