Rimuovi la gestione del rilascio dei tasti e migliora la logica di scrolling nella classe KeyBindings; aggiorna la classe GameWindow per gestire correttamente gli eventi di rilascio dei tasti
This commit is contained in:
@@ -155,26 +155,6 @@ class MiceMaze(controls.KeyBindings):
|
||||
def add_point(self, value):
|
||||
self.points += value
|
||||
|
||||
def start_scrolling(self, direction):
|
||||
self.scrolling_direction = direction
|
||||
if not self.scrolling:
|
||||
self.scrolling = 1
|
||||
|
||||
def stop_scrolling(self):
|
||||
self.scrolling = 0
|
||||
|
||||
def scroll(self):
|
||||
if self.scrolling:
|
||||
if not self.scrolling % 5:
|
||||
if self.scrolling_direction == "Up":
|
||||
self.scroll_cursor(y=-1)
|
||||
elif self.scrolling_direction == "Down":
|
||||
self.scroll_cursor(y=1)
|
||||
elif self.scrolling_direction == "Left":
|
||||
self.scroll_cursor(x=-1)
|
||||
elif self.scrolling_direction == "Right":
|
||||
self.scroll_cursor(x=1)
|
||||
self.scrolling += 1
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
|
||||
Reference in New Issue
Block a user