Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Cooperative Cuisine Environment
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Social Cognitive Systems
CoCoSy
Cooperative Cuisine Environment
Commits
5ba7407d
Commit
5ba7407d
authored
1 year ago
by
fheinrich
Browse files
Options
Downloads
Patches
Plain Diff
Fix controller input
parent
6fb6e6e5
No related branches found
No related tags found
1 merge request
!62
Resolve "Game Flow"
Pipeline
#46912
passed
1 year ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
overcooked_simulator/gui_2d_vis/overcooked_gui.py
+5
-7
5 additions, 7 deletions
overcooked_simulator/gui_2d_vis/overcooked_gui.py
with
5 additions
and
7 deletions
overcooked_simulator/gui_2d_vis/overcooked_gui.py
+
5
−
7
View file @
5ba7407d
...
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment