Skip to content
Snippets Groups Projects
Commit 5ba7407d authored by fheinrich's avatar fheinrich
Browse files

Fix controller input

parent 6fb6e6e5
No related branches found
No related tags found
1 merge request!62Resolve "Game Flow"
Pipeline #46912 passed
......@@ -262,8 +262,8 @@ class PyGameGUI:
if abs(axis_up_down) > tolerance_threshold:
move_vec[1] += axis_up_down
if np.linalg.norm(move_vec) != 0:
move_vec = move_vec / np.linalg.norm(move_vec)
# if np.linalg.norm(move_vec) != 0:
# move_vec = move_vec / np.linalg.norm(move_vec)
action = Action(
current_player_name,
......@@ -312,7 +312,6 @@ class PyGameGUI:
event: Pygame event for extracting the button action.
joysticks: list of joysticks
"""
for key_set in self.key_sets:
current_player_name = str(key_set.current_player)
# if a joystick is connected for current player
......@@ -879,6 +878,7 @@ class PyGameGUI:
def draw_tutorial_screen_frame(self):
self.handle_keys()
self.handle_joy_stick_input(joysticks=self.joysticks)
state = self.request_state()
self.vis.draw_gamescreen(
......@@ -896,6 +896,7 @@ class PyGameGUI:
self.last_state = self.request_state()
self.handle_keys()
self.handle_joy_stick_input(joysticks=self.joysticks)
if self.last_state["ended"]:
self.menu_state = MenuStates.PostGame
......@@ -1485,10 +1486,7 @@ class PyGameGUI:
]:
self.handle_key_event(event)
if (
event.type in [pygame.JOYBUTTONDOWN, pygame.JOYBUTTONUP]
and self.menu_state == MenuStates.Game
):
if event.type in [pygame.JOYBUTTONDOWN, pygame.JOYBUTTONUP] and self.menu_state in [MenuStates.Game, MenuStates.ControllerTutorial]:
self.handle_joy_stick_event(event, joysticks=self.joysticks)
self.manager.process_events(event)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment