From 491d9374d1caa514119d9114d987a2d50803ed5d Mon Sep 17 00:00:00 2001 From: JDLiang Date: Mon, 13 Feb 2023 19:38:09 -0800 Subject: [PATCH 01/36] background --- arcade/examples/joystick_controller.py | 43 +++++++++++++++++++ .../how_to_examples/joystick_controller.rst | 0 2 files changed, 43 insertions(+) create mode 100644 arcade/examples/joystick_controller.py create mode 100644 doc/example_code/how_to_examples/joystick_controller.rst diff --git a/arcade/examples/joystick_controller.py b/arcade/examples/joystick_controller.py new file mode 100644 index 000000000..6475654ab --- /dev/null +++ b/arcade/examples/joystick_controller.py @@ -0,0 +1,43 @@ +""" +Platformer Game +""" +import arcade + +# Constants +SCREEN_WIDTH = 1000 +SCREEN_HEIGHT = 650 +SCREEN_TITLE = "Platformer" + + +class MyGame(arcade.Window): + """ + Main application class. + """ + + def __init__(self): + + # Call the parent class and set up the window + super().__init__(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE) + + arcade.set_background_color(arcade.csscolor.CORNFLOWER_BLUE) + + def setup(self): + """Set up the game here. Call this function to restart the game.""" + pass + + def on_draw(self): + """Render the screen.""" + + self.clear() + # Code to draw the screen goes here + + +def main(): + """Main function""" + window = MyGame() + window.setup() + arcade.run() + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/doc/example_code/how_to_examples/joystick_controller.rst b/doc/example_code/how_to_examples/joystick_controller.rst new file mode 100644 index 000000000..e69de29bb From 47dfe2b0c9722992c37d3a59c45d2f39cac78933 Mon Sep 17 00:00:00 2001 From: JDLiang Date: Mon, 13 Feb 2023 20:05:15 -0800 Subject: [PATCH 02/36] Added a zombie character --- arcade/examples/joystick_controller.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/arcade/examples/joystick_controller.py b/arcade/examples/joystick_controller.py index 6475654ab..06bfa3d4d 100644 --- a/arcade/examples/joystick_controller.py +++ b/arcade/examples/joystick_controller.py @@ -5,8 +5,9 @@ # Constants SCREEN_WIDTH = 1000 -SCREEN_HEIGHT = 650 +SCREEN_HEIGHT = 1000 SCREEN_TITLE = "Platformer" +CHARACTER_SCALING = 0.5 class MyGame(arcade.Window): @@ -19,18 +20,29 @@ def __init__(self): # Call the parent class and set up the window super().__init__(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE) - arcade.set_background_color(arcade.csscolor.CORNFLOWER_BLUE) + arcade.set_background_color(arcade.csscolor.AZURE) def setup(self): """Set up the game here. Call this function to restart the game.""" - pass - + # Create the Sprite lists + self.player_list = arcade.SpriteList() + self.wall_list = arcade.SpriteList(use_spatial_hash=True) + + # Set up the player, specifically placing it at these coordinates. + image_source = ":resources:images/animated_characters/zombie/zombie_idle.png" + self.player_sprite = arcade.Sprite(image_source, CHARACTER_SCALING) + self.player_sprite.center_x = 500 + self.player_sprite.center_y = 500 + self.player_list.append(self.player_sprite) + def on_draw(self): """Render the screen.""" + # Clear the screen to the background color self.clear() - # Code to draw the screen goes here + # Draw our sprites + self.player_list.draw() def main(): """Main function""" From 694b0056649a8e14def5b947c63502edef2f32ea Mon Sep 17 00:00:00 2001 From: JDLiang Date: Mon, 13 Feb 2023 20:46:58 -0800 Subject: [PATCH 03/36] object moves --- arcade/examples/joystick_controller.py | 53 +++++++++++++++++++++++--- arcade/examples/tempCodeRunnerFile.py | 1 + 2 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 arcade/examples/tempCodeRunnerFile.py diff --git a/arcade/examples/joystick_controller.py b/arcade/examples/joystick_controller.py index 06bfa3d4d..c4f73c93e 100644 --- a/arcade/examples/joystick_controller.py +++ b/arcade/examples/joystick_controller.py @@ -1,14 +1,15 @@ """ -Platformer Game +Joystick_Controller Sample """ import arcade # Constants SCREEN_WIDTH = 1000 SCREEN_HEIGHT = 1000 -SCREEN_TITLE = "Platformer" +SCREEN_TITLE = "Joystick_Controller" CHARACTER_SCALING = 0.5 - +PLAYER_MOVEMENT_SPEED = 5 +TILE_SCALING = 0.5 class MyGame(arcade.Window): """ @@ -19,7 +20,8 @@ def __init__(self): # Call the parent class and set up the window super().__init__(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE) - + self.physics_engine = None + self.scene = None arcade.set_background_color(arcade.csscolor.AZURE) def setup(self): @@ -27,13 +29,23 @@ def setup(self): # Create the Sprite lists self.player_list = arcade.SpriteList() self.wall_list = arcade.SpriteList(use_spatial_hash=True) - + self.scene = arcade.Scene() + for x in range(0, 1250, 64): + wall = arcade.Sprite(":resources:images/tiles/grassMid.png", TILE_SCALING) + wall.center_x = x + wall.center_y = 32 + self.scene.add_sprite("Walls", wall) # Set up the player, specifically placing it at these coordinates. image_source = ":resources:images/animated_characters/zombie/zombie_idle.png" self.player_sprite = arcade.Sprite(image_source, CHARACTER_SCALING) self.player_sprite.center_x = 500 self.player_sprite.center_y = 500 + self.scene.add_sprite("Player", self.player_sprite) self.player_list.append(self.player_sprite) + # Create the 'physics engine' + self.physics_engine = arcade.PhysicsEngineSimple( + self.player_sprite, self.scene.get_sprite_list("Walls") + ) def on_draw(self): """Render the screen.""" @@ -43,10 +55,41 @@ def on_draw(self): # Draw our sprites self.player_list.draw() + def on_key_press(self, key, modifiers): + + if key == arcade.key.UP or key == arcade.key.W: + self.player_sprite.change_y = PLAYER_MOVEMENT_SPEED + elif key == arcade.key.DOWN or key == arcade.key.S: + self.player_sprite.change_y = -PLAYER_MOVEMENT_SPEED + elif key == arcade.key.LEFT or key == arcade.key.A: + self.player_sprite.change_x = -PLAYER_MOVEMENT_SPEED + elif key == arcade.key.RIGHT or key == arcade.key.D: + self.player_sprite.change_x = PLAYER_MOVEMENT_SPEED + + def on_key_release(self, key, modifiers): + """Called when the user releases a key.""" + + if key == arcade.key.UP or key == arcade.key.W: + self.player_sprite.change_y = 0 + elif key == arcade.key.DOWN or key == arcade.key.S: + self.player_sprite.change_y = 0 + elif key == arcade.key.LEFT or key == arcade.key.A: + self.player_sprite.change_x = 0 + elif key == arcade.key.RIGHT or key == arcade.key.D: + self.player_sprite.change_x = 0 + + def on_update(self, delta_time): + """Movement and game logic""" + + # Move the player with the physics engine + self.physics_engine.update() def main(): """Main function""" window = MyGame() + window.joys = arcade.get_joysticks()#gets the joystick + if len(window.joys) == 0:#if joytick list is empty there is not joystick connected + print("No Joystick") window.setup() arcade.run() diff --git a/arcade/examples/tempCodeRunnerFile.py b/arcade/examples/tempCodeRunnerFile.py new file mode 100644 index 000000000..d55e9f544 --- /dev/null +++ b/arcade/examples/tempCodeRunnerFile.py @@ -0,0 +1 @@ + window.joys = arcade.get_joysticks()#gets the joystick \ No newline at end of file From cf7c02ad9e8a5378d1882f1d52a618d2b645b21a Mon Sep 17 00:00:00 2001 From: JDLiang Date: Sat, 18 Feb 2023 11:02:55 -0800 Subject: [PATCH 04/36] deleted the .py file and set up the .rst file --- arcade/examples/joystick_controller.py | 98 ------------------- .../how_to_examples/joystick_controller.rst | 14 +++ 2 files changed, 14 insertions(+), 98 deletions(-) delete mode 100644 arcade/examples/joystick_controller.py diff --git a/arcade/examples/joystick_controller.py b/arcade/examples/joystick_controller.py deleted file mode 100644 index c4f73c93e..000000000 --- a/arcade/examples/joystick_controller.py +++ /dev/null @@ -1,98 +0,0 @@ -""" -Joystick_Controller Sample -""" -import arcade - -# Constants -SCREEN_WIDTH = 1000 -SCREEN_HEIGHT = 1000 -SCREEN_TITLE = "Joystick_Controller" -CHARACTER_SCALING = 0.5 -PLAYER_MOVEMENT_SPEED = 5 -TILE_SCALING = 0.5 - -class MyGame(arcade.Window): - """ - Main application class. - """ - - def __init__(self): - - # Call the parent class and set up the window - super().__init__(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE) - self.physics_engine = None - self.scene = None - arcade.set_background_color(arcade.csscolor.AZURE) - - def setup(self): - """Set up the game here. Call this function to restart the game.""" - # Create the Sprite lists - self.player_list = arcade.SpriteList() - self.wall_list = arcade.SpriteList(use_spatial_hash=True) - self.scene = arcade.Scene() - for x in range(0, 1250, 64): - wall = arcade.Sprite(":resources:images/tiles/grassMid.png", TILE_SCALING) - wall.center_x = x - wall.center_y = 32 - self.scene.add_sprite("Walls", wall) - # Set up the player, specifically placing it at these coordinates. - image_source = ":resources:images/animated_characters/zombie/zombie_idle.png" - self.player_sprite = arcade.Sprite(image_source, CHARACTER_SCALING) - self.player_sprite.center_x = 500 - self.player_sprite.center_y = 500 - self.scene.add_sprite("Player", self.player_sprite) - self.player_list.append(self.player_sprite) - # Create the 'physics engine' - self.physics_engine = arcade.PhysicsEngineSimple( - self.player_sprite, self.scene.get_sprite_list("Walls") - ) - - def on_draw(self): - """Render the screen.""" - - # Clear the screen to the background color - self.clear() - - # Draw our sprites - self.player_list.draw() - def on_key_press(self, key, modifiers): - - if key == arcade.key.UP or key == arcade.key.W: - self.player_sprite.change_y = PLAYER_MOVEMENT_SPEED - elif key == arcade.key.DOWN or key == arcade.key.S: - self.player_sprite.change_y = -PLAYER_MOVEMENT_SPEED - elif key == arcade.key.LEFT or key == arcade.key.A: - self.player_sprite.change_x = -PLAYER_MOVEMENT_SPEED - elif key == arcade.key.RIGHT or key == arcade.key.D: - self.player_sprite.change_x = PLAYER_MOVEMENT_SPEED - - def on_key_release(self, key, modifiers): - """Called when the user releases a key.""" - - if key == arcade.key.UP or key == arcade.key.W: - self.player_sprite.change_y = 0 - elif key == arcade.key.DOWN or key == arcade.key.S: - self.player_sprite.change_y = 0 - elif key == arcade.key.LEFT or key == arcade.key.A: - self.player_sprite.change_x = 0 - elif key == arcade.key.RIGHT or key == arcade.key.D: - self.player_sprite.change_x = 0 - - def on_update(self, delta_time): - """Movement and game logic""" - - # Move the player with the physics engine - self.physics_engine.update() - -def main(): - """Main function""" - window = MyGame() - window.joys = arcade.get_joysticks()#gets the joystick - if len(window.joys) == 0:#if joytick list is empty there is not joystick connected - print("No Joystick") - window.setup() - arcade.run() - - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/doc/example_code/how_to_examples/joystick_controller.rst b/doc/example_code/how_to_examples/joystick_controller.rst index e69de29bb..fd0cc3cb1 100644 --- a/doc/example_code/how_to_examples/joystick_controller.rst +++ b/doc/example_code/how_to_examples/joystick_controller.rst @@ -0,0 +1,14 @@ +.. _example-code: + +How-To Example Code +=================== +How to use buttons +=================== +How to use hatHow to use ranged triggers (like for acceleration) +================================================================= +Different types of controllers +============================== +How the (-1.0 to 1.0) range works +================================== +Deadzone +======== \ No newline at end of file From ab61c8cf7bb3c2a708273e7d9a3901a886860a69 Mon Sep 17 00:00:00 2001 From: JDLiang Date: Sat, 18 Feb 2023 11:16:01 -0800 Subject: [PATCH 05/36] trial --- doc/example_code/how_to_examples/joystick_controller.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doc/example_code/how_to_examples/joystick_controller.rst b/doc/example_code/how_to_examples/joystick_controller.rst index fd0cc3cb1..558750f27 100644 --- a/doc/example_code/how_to_examples/joystick_controller.rst +++ b/doc/example_code/how_to_examples/joystick_controller.rst @@ -2,6 +2,15 @@ How-To Example Code =================== +We can get a list of connected controllers by using 'arcade.get_joysticks()'. This will give you a list of current connected controllers. + +joysticks = arcade.get_joysticks() +if joysticks: + self.joystick = joysticks[0] + self.joystick.open() +else: + print("There are no joysticks.") + self.joystick = None How to use buttons =================== How to use hatHow to use ranged triggers (like for acceleration) From 033dd77bb2b67663f185abbf8042ad7122cece24 Mon Sep 17 00:00:00 2001 From: JDLiang100 <86375529+JDLiang100@users.noreply.github.com> Date: Sat, 18 Feb 2023 11:17:45 -0800 Subject: [PATCH 06/36] Update joystick_controller.rst --- .../how_to_examples/joystick_controller.rst | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/doc/example_code/how_to_examples/joystick_controller.rst b/doc/example_code/how_to_examples/joystick_controller.rst index 558750f27..57682eb86 100644 --- a/doc/example_code/how_to_examples/joystick_controller.rst +++ b/doc/example_code/how_to_examples/joystick_controller.rst @@ -4,13 +4,14 @@ How-To Example Code =================== We can get a list of connected controllers by using 'arcade.get_joysticks()'. This will give you a list of current connected controllers. -joysticks = arcade.get_joysticks() -if joysticks: - self.joystick = joysticks[0] - self.joystick.open() -else: - print("There are no joysticks.") - self.joystick = None +.. code:: python + joysticks = arcade.get_joysticks() + if joysticks: + self.joystick = joysticks[0] + self.joystick.open() + else: + print("There are no joysticks.") + self.joystick = None How to use buttons =================== How to use hatHow to use ranged triggers (like for acceleration) @@ -20,4 +21,4 @@ Different types of controllers How the (-1.0 to 1.0) range works ================================== Deadzone -======== \ No newline at end of file +======== From 8851483c428d64c065c147c3efa5654c4632f2f4 Mon Sep 17 00:00:00 2001 From: JDLiang100 <86375529+JDLiang100@users.noreply.github.com> Date: Sat, 18 Feb 2023 11:19:08 -0800 Subject: [PATCH 07/36] Update joystick_controller.rst --- doc/example_code/how_to_examples/joystick_controller.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/example_code/how_to_examples/joystick_controller.rst b/doc/example_code/how_to_examples/joystick_controller.rst index 57682eb86..c654ad568 100644 --- a/doc/example_code/how_to_examples/joystick_controller.rst +++ b/doc/example_code/how_to_examples/joystick_controller.rst @@ -4,7 +4,7 @@ How-To Example Code =================== We can get a list of connected controllers by using 'arcade.get_joysticks()'. This will give you a list of current connected controllers. -.. code:: python +.. code-block:: joysticks = arcade.get_joysticks() if joysticks: self.joystick = joysticks[0] From 4d88f11f030ace4bffb0008b6858d1ffd07fce67 Mon Sep 17 00:00:00 2001 From: JDLiang100 <86375529+JDLiang100@users.noreply.github.com> Date: Sat, 18 Feb 2023 11:20:45 -0800 Subject: [PATCH 08/36] Update joystick_controller.rst --- doc/example_code/how_to_examples/joystick_controller.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/example_code/how_to_examples/joystick_controller.rst b/doc/example_code/how_to_examples/joystick_controller.rst index c654ad568..881e7989d 100644 --- a/doc/example_code/how_to_examples/joystick_controller.rst +++ b/doc/example_code/how_to_examples/joystick_controller.rst @@ -4,7 +4,7 @@ How-To Example Code =================== We can get a list of connected controllers by using 'arcade.get_joysticks()'. This will give you a list of current connected controllers. -.. code-block:: +``code`` joysticks = arcade.get_joysticks() if joysticks: self.joystick = joysticks[0] From c4c7f52215d0bb941967e6434991e7ef598cac35 Mon Sep 17 00:00:00 2001 From: JDLiang100 <86375529+JDLiang100@users.noreply.github.com> Date: Sat, 18 Feb 2023 11:21:58 -0800 Subject: [PATCH 09/36] Update joystick_controller.rst --- doc/example_code/how_to_examples/joystick_controller.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/example_code/how_to_examples/joystick_controller.rst b/doc/example_code/how_to_examples/joystick_controller.rst index 881e7989d..3620eec8d 100644 --- a/doc/example_code/how_to_examples/joystick_controller.rst +++ b/doc/example_code/how_to_examples/joystick_controller.rst @@ -3,7 +3,7 @@ How-To Example Code =================== We can get a list of connected controllers by using 'arcade.get_joysticks()'. This will give you a list of current connected controllers. - +:code:`a = b + c` ``code`` joysticks = arcade.get_joysticks() if joysticks: From 85b520338cdc1a5a0cd65ef239f5a86080e944f8 Mon Sep 17 00:00:00 2001 From: JDLiang100 <86375529+JDLiang100@users.noreply.github.com> Date: Sat, 18 Feb 2023 11:22:51 -0800 Subject: [PATCH 10/36] Update joystick_controller.rst --- .../how_to_examples/joystick_controller.rst | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/doc/example_code/how_to_examples/joystick_controller.rst b/doc/example_code/how_to_examples/joystick_controller.rst index 3620eec8d..9e7baea09 100644 --- a/doc/example_code/how_to_examples/joystick_controller.rst +++ b/doc/example_code/how_to_examples/joystick_controller.rst @@ -3,15 +3,13 @@ How-To Example Code =================== We can get a list of connected controllers by using 'arcade.get_joysticks()'. This will give you a list of current connected controllers. -:code:`a = b + c` -``code`` - joysticks = arcade.get_joysticks() - if joysticks: - self.joystick = joysticks[0] - self.joystick.open() - else: - print("There are no joysticks.") - self.joystick = None +:code:`joysticks = arcade.get_joysticks() +if joysticks: + self.joystick = joysticks[0] + self.joystick.open() +else: + print("There are no joysticks.") + self.joystick = None` How to use buttons =================== How to use hatHow to use ranged triggers (like for acceleration) From 0a4cb8fad43a29f7efd16a0a0c3632b78082f3de Mon Sep 17 00:00:00 2001 From: JDLiang100 <86375529+JDLiang100@users.noreply.github.com> Date: Sat, 18 Feb 2023 11:24:13 -0800 Subject: [PATCH 11/36] Update joystick_controller.rst --- doc/example_code/how_to_examples/joystick_controller.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/example_code/how_to_examples/joystick_controller.rst b/doc/example_code/how_to_examples/joystick_controller.rst index 9e7baea09..d3637369c 100644 --- a/doc/example_code/how_to_examples/joystick_controller.rst +++ b/doc/example_code/how_to_examples/joystick_controller.rst @@ -3,7 +3,7 @@ How-To Example Code =================== We can get a list of connected controllers by using 'arcade.get_joysticks()'. This will give you a list of current connected controllers. -:code:`joysticks = arcade.get_joysticks() +:code:`joysticks = arcade.get_joysticks()\nif joysticks:\nif joysticks:` if joysticks: self.joystick = joysticks[0] self.joystick.open() From a3d592f013c4066df6f20e2068ec4e0fa7f66935 Mon Sep 17 00:00:00 2001 From: JDLiang100 <86375529+JDLiang100@users.noreply.github.com> Date: Sat, 18 Feb 2023 11:27:44 -0800 Subject: [PATCH 12/36] Update joystick_controller.rst --- doc/example_code/how_to_examples/joystick_controller.rst | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/doc/example_code/how_to_examples/joystick_controller.rst b/doc/example_code/how_to_examples/joystick_controller.rst index d3637369c..126c92fd9 100644 --- a/doc/example_code/how_to_examples/joystick_controller.rst +++ b/doc/example_code/how_to_examples/joystick_controller.rst @@ -2,14 +2,7 @@ How-To Example Code =================== -We can get a list of connected controllers by using 'arcade.get_joysticks()'. This will give you a list of current connected controllers. -:code:`joysticks = arcade.get_joysticks()\nif joysticks:\nif joysticks:` -if joysticks: - self.joystick = joysticks[0] - self.joystick.open() -else: - print("There are no joysticks.") - self.joystick = None` +We can get a list of connected controllers by using :`code:arcade.get_joysticks()`. This will give you a list of current connected controllers. How to use buttons =================== How to use hatHow to use ranged triggers (like for acceleration) From f7b2b961055b176d80cf033a445d25a436aef173 Mon Sep 17 00:00:00 2001 From: JDLiang100 <86375529+JDLiang100@users.noreply.github.com> Date: Sat, 18 Feb 2023 11:28:03 -0800 Subject: [PATCH 13/36] Update joystick_controller.rst --- doc/example_code/how_to_examples/joystick_controller.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/example_code/how_to_examples/joystick_controller.rst b/doc/example_code/how_to_examples/joystick_controller.rst index 126c92fd9..742f115ab 100644 --- a/doc/example_code/how_to_examples/joystick_controller.rst +++ b/doc/example_code/how_to_examples/joystick_controller.rst @@ -2,7 +2,7 @@ How-To Example Code =================== -We can get a list of connected controllers by using :`code:arcade.get_joysticks()`. This will give you a list of current connected controllers. +We can get a list of connected controllers by using :code:`arcade.get_joysticks()`. This will give you a list of current connected controllers. How to use buttons =================== How to use hatHow to use ranged triggers (like for acceleration) From 2dd834eb831155f45c870e9325a1712f28171887 Mon Sep 17 00:00:00 2001 From: JDLiang100 <86375529+JDLiang100@users.noreply.github.com> Date: Sat, 18 Feb 2023 11:28:15 -0800 Subject: [PATCH 14/36] Update joystick_controller.rst --- doc/example_code/how_to_examples/joystick_controller.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/example_code/how_to_examples/joystick_controller.rst b/doc/example_code/how_to_examples/joystick_controller.rst index 742f115ab..756c89494 100644 --- a/doc/example_code/how_to_examples/joystick_controller.rst +++ b/doc/example_code/how_to_examples/joystick_controller.rst @@ -3,6 +3,7 @@ How-To Example Code =================== We can get a list of connected controllers by using :code:`arcade.get_joysticks()`. This will give you a list of current connected controllers. + How to use buttons =================== How to use hatHow to use ranged triggers (like for acceleration) From bd693b8ed3512e0338160a6d516e5d3ede2888ba Mon Sep 17 00:00:00 2001 From: JDLiang100 <86375529+JDLiang100@users.noreply.github.com> Date: Sat, 18 Feb 2023 11:28:39 -0800 Subject: [PATCH 15/36] Update joystick_controller.rst --- doc/example_code/how_to_examples/joystick_controller.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/example_code/how_to_examples/joystick_controller.rst b/doc/example_code/how_to_examples/joystick_controller.rst index 756c89494..e6fc8b8a6 100644 --- a/doc/example_code/how_to_examples/joystick_controller.rst +++ b/doc/example_code/how_to_examples/joystick_controller.rst @@ -2,7 +2,7 @@ How-To Example Code =================== -We can get a list of connected controllers by using :code:`arcade.get_joysticks()`. This will give you a list of current connected controllers. +We can get a list of connected controllers by using :code:`arcade.get_joysticks()`. How to use buttons =================== From 501cf55c55947db794ee053a5c8a45eafe3acc3f Mon Sep 17 00:00:00 2001 From: JDLiang100 <86375529+JDLiang100@users.noreply.github.com> Date: Sat, 18 Feb 2023 11:30:57 -0800 Subject: [PATCH 16/36] Update joystick_controller.rst --- doc/example_code/how_to_examples/joystick_controller.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/example_code/how_to_examples/joystick_controller.rst b/doc/example_code/how_to_examples/joystick_controller.rst index e6fc8b8a6..6ca7f287e 100644 --- a/doc/example_code/how_to_examples/joystick_controller.rst +++ b/doc/example_code/how_to_examples/joystick_controller.rst @@ -3,7 +3,8 @@ How-To Example Code =================== We can get a list of connected controllers by using :code:`arcade.get_joysticks()`. - +Joystick Values +================ How to use buttons =================== How to use hatHow to use ranged triggers (like for acceleration) From 5aaeb0bcf558cad5eb91ad776513a39248aafe78 Mon Sep 17 00:00:00 2001 From: JDLiang100 <86375529+JDLiang100@users.noreply.github.com> Date: Sat, 18 Feb 2023 11:31:06 -0800 Subject: [PATCH 17/36] Update joystick_controller.rst --- doc/example_code/how_to_examples/joystick_controller.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/example_code/how_to_examples/joystick_controller.rst b/doc/example_code/how_to_examples/joystick_controller.rst index 6ca7f287e..d4d668406 100644 --- a/doc/example_code/how_to_examples/joystick_controller.rst +++ b/doc/example_code/how_to_examples/joystick_controller.rst @@ -3,6 +3,7 @@ How-To Example Code =================== We can get a list of connected controllers by using :code:`arcade.get_joysticks()`. + Joystick Values ================ How to use buttons From a2422d816c3c829cc6c428456e04b11deeed51dd Mon Sep 17 00:00:00 2001 From: JDLiang100 <86375529+JDLiang100@users.noreply.github.com> Date: Sat, 18 Feb 2023 11:32:53 -0800 Subject: [PATCH 18/36] Update joystick_controller.rst --- doc/example_code/how_to_examples/joystick_controller.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doc/example_code/how_to_examples/joystick_controller.rst b/doc/example_code/how_to_examples/joystick_controller.rst index d4d668406..bb21303c6 100644 --- a/doc/example_code/how_to_examples/joystick_controller.rst +++ b/doc/example_code/how_to_examples/joystick_controller.rst @@ -3,6 +3,15 @@ How-To Example Code =================== We can get a list of connected controllers by using :code:`arcade.get_joysticks()`. +.. code-block:: javascript +joysticks = arcade.get_joysticks() +if joysticks: + self.joystick = joysticks[0] + self.joystick.open() +else: + print("There are no joysticks.") + self.joystick = None +code . . . Joystick Values ================ From a5d2297e26532162ab52956a3ab0788f45c7d492 Mon Sep 17 00:00:00 2001 From: JDLiang100 <86375529+JDLiang100@users.noreply.github.com> Date: Sat, 18 Feb 2023 11:33:19 -0800 Subject: [PATCH 19/36] Update joystick_controller.rst --- doc/example_code/how_to_examples/joystick_controller.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/example_code/how_to_examples/joystick_controller.rst b/doc/example_code/how_to_examples/joystick_controller.rst index bb21303c6..8dd41e9f0 100644 --- a/doc/example_code/how_to_examples/joystick_controller.rst +++ b/doc/example_code/how_to_examples/joystick_controller.rst @@ -3,7 +3,7 @@ How-To Example Code =================== We can get a list of connected controllers by using :code:`arcade.get_joysticks()`. -.. code-block:: javascript +.. code-block:: python joysticks = arcade.get_joysticks() if joysticks: self.joystick = joysticks[0] From d501ac24dcf95428c35400e4a087764217e849a8 Mon Sep 17 00:00:00 2001 From: JDLiang100 <86375529+JDLiang100@users.noreply.github.com> Date: Sat, 18 Feb 2023 11:35:11 -0800 Subject: [PATCH 20/36] Update joystick_controller.rst --- .../how_to_examples/joystick_controller.rst | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/doc/example_code/how_to_examples/joystick_controller.rst b/doc/example_code/how_to_examples/joystick_controller.rst index 8dd41e9f0..35c9e1472 100644 --- a/doc/example_code/how_to_examples/joystick_controller.rst +++ b/doc/example_code/how_to_examples/joystick_controller.rst @@ -4,14 +4,8 @@ How-To Example Code =================== We can get a list of connected controllers by using :code:`arcade.get_joysticks()`. .. code-block:: python -joysticks = arcade.get_joysticks() -if joysticks: - self.joystick = joysticks[0] - self.joystick.open() -else: - print("There are no joysticks.") - self.joystick = None -code . . . + + pygments_style = 'sphinx' Joystick Values ================ From d56ed9fae3e556b31124a2c4e8947384ec44e7ea Mon Sep 17 00:00:00 2001 From: JDLiang100 <86375529+JDLiang100@users.noreply.github.com> Date: Sat, 18 Feb 2023 11:35:53 -0800 Subject: [PATCH 21/36] Update joystick_controller.rst --- doc/example_code/how_to_examples/joystick_controller.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/example_code/how_to_examples/joystick_controller.rst b/doc/example_code/how_to_examples/joystick_controller.rst index 35c9e1472..a6297e3c4 100644 --- a/doc/example_code/how_to_examples/joystick_controller.rst +++ b/doc/example_code/how_to_examples/joystick_controller.rst @@ -5,7 +5,13 @@ How-To Example Code We can get a list of connected controllers by using :code:`arcade.get_joysticks()`. .. code-block:: python - pygments_style = 'sphinx' + joysticks = arcade.get_joysticks() + if joysticks: + self.joystick = joysticks[0] + self.joystick.open() + else: + print("There are no joysticks.") + self.joystick = None Joystick Values ================ From e1cf18e12a7447fbf76a1e2287b026b4f1c09921 Mon Sep 17 00:00:00 2001 From: JDLiang100 <86375529+JDLiang100@users.noreply.github.com> Date: Sat, 18 Feb 2023 11:39:47 -0800 Subject: [PATCH 22/36] Update joystick_controller.rst --- .../how_to_examples/joystick_controller.rst | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/doc/example_code/how_to_examples/joystick_controller.rst b/doc/example_code/how_to_examples/joystick_controller.rst index a6297e3c4..f850f77d0 100644 --- a/doc/example_code/how_to_examples/joystick_controller.rst +++ b/doc/example_code/how_to_examples/joystick_controller.rst @@ -3,15 +3,12 @@ How-To Example Code =================== We can get a list of connected controllers by using :code:`arcade.get_joysticks()`. + .. code-block:: python - joysticks = arcade.get_joysticks() - if joysticks: - self.joystick = joysticks[0] - self.joystick.open() - else: - print("There are no joysticks.") - self.joystick = None + def my_function(): + print("Hello, world!") + print("This is a multi-line code block.") Joystick Values ================ From cea42535619132976a14fa8c77d3ee12d6ce695e Mon Sep 17 00:00:00 2001 From: JDLiang100 <86375529+JDLiang100@users.noreply.github.com> Date: Sat, 18 Feb 2023 11:40:05 -0800 Subject: [PATCH 23/36] Update joystick_controller.rst --- doc/example_code/how_to_examples/joystick_controller.rst | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/doc/example_code/how_to_examples/joystick_controller.rst b/doc/example_code/how_to_examples/joystick_controller.rst index f850f77d0..81b244a34 100644 --- a/doc/example_code/how_to_examples/joystick_controller.rst +++ b/doc/example_code/how_to_examples/joystick_controller.rst @@ -6,9 +6,8 @@ We can get a list of connected controllers by using :code:`arcade.get_joysticks( .. code-block:: python - def my_function(): - print("Hello, world!") - print("This is a multi-line code block.") + print("Hello, world!") + print("This is a multi-line code block.") Joystick Values ================ From 9e33610a0452bb59ffb607ca6af20a9cfa17d044 Mon Sep 17 00:00:00 2001 From: JDLiang100 <86375529+JDLiang100@users.noreply.github.com> Date: Sat, 18 Feb 2023 11:40:21 -0800 Subject: [PATCH 24/36] Update joystick_controller.rst --- .../how_to_examples/joystick_controller.rst | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/doc/example_code/how_to_examples/joystick_controller.rst b/doc/example_code/how_to_examples/joystick_controller.rst index 81b244a34..1894c343e 100644 --- a/doc/example_code/how_to_examples/joystick_controller.rst +++ b/doc/example_code/how_to_examples/joystick_controller.rst @@ -5,9 +5,13 @@ How-To Example Code We can get a list of connected controllers by using :code:`arcade.get_joysticks()`. .. code-block:: python - - print("Hello, world!") - print("This is a multi-line code block.") + joysticks = arcade.get_joysticks() + if joysticks: + self.joystick = joysticks[0] + self.joystick.open() + else: + print("There are no joysticks.") + self.joystick = None Joystick Values ================ From 5ebd12f4a9e0c1e4bb773027767334064deace28 Mon Sep 17 00:00:00 2001 From: JDLiang100 <86375529+JDLiang100@users.noreply.github.com> Date: Sat, 18 Feb 2023 11:40:29 -0800 Subject: [PATCH 25/36] Update joystick_controller.rst --- doc/example_code/how_to_examples/joystick_controller.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/example_code/how_to_examples/joystick_controller.rst b/doc/example_code/how_to_examples/joystick_controller.rst index 1894c343e..c3013409e 100644 --- a/doc/example_code/how_to_examples/joystick_controller.rst +++ b/doc/example_code/how_to_examples/joystick_controller.rst @@ -5,6 +5,7 @@ How-To Example Code We can get a list of connected controllers by using :code:`arcade.get_joysticks()`. .. code-block:: python + joysticks = arcade.get_joysticks() if joysticks: self.joystick = joysticks[0] From 5df0b727dca018e34414da5b8de1db541e7da67b Mon Sep 17 00:00:00 2001 From: JDLiang100 <86375529+JDLiang100@users.noreply.github.com> Date: Sat, 18 Feb 2023 11:40:50 -0800 Subject: [PATCH 26/36] Update joystick_controller.rst --- doc/example_code/how_to_examples/joystick_controller.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/example_code/how_to_examples/joystick_controller.rst b/doc/example_code/how_to_examples/joystick_controller.rst index c3013409e..8947b7889 100644 --- a/doc/example_code/how_to_examples/joystick_controller.rst +++ b/doc/example_code/how_to_examples/joystick_controller.rst @@ -2,7 +2,7 @@ How-To Example Code =================== -We can get a list of connected controllers by using :code:`arcade.get_joysticks()`. +We can get a list of connected controllers by using :code:`arcade.get_joysticks()`. There might be multiple controllers in the list .. code-block:: python From c849727bdf692d38a6e9eb3bcf95d7418a85eea5 Mon Sep 17 00:00:00 2001 From: JDLiang100 <86375529+JDLiang100@users.noreply.github.com> Date: Sat, 18 Feb 2023 11:41:36 -0800 Subject: [PATCH 27/36] Update joystick_controller.rst --- doc/example_code/how_to_examples/joystick_controller.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/example_code/how_to_examples/joystick_controller.rst b/doc/example_code/how_to_examples/joystick_controller.rst index 8947b7889..870308801 100644 --- a/doc/example_code/how_to_examples/joystick_controller.rst +++ b/doc/example_code/how_to_examples/joystick_controller.rst @@ -1,6 +1,6 @@ .. _example-code: -How-To Example Code +How to get connected controllers =================== We can get a list of connected controllers by using :code:`arcade.get_joysticks()`. There might be multiple controllers in the list @@ -26,3 +26,5 @@ How the (-1.0 to 1.0) range works ================================== Deadzone ======== +How-To Example Code +=================== From cb875eaf4e0400a41f39fd814ea954f14fd823f5 Mon Sep 17 00:00:00 2001 From: JDLiang100 <86375529+JDLiang100@users.noreply.github.com> Date: Sat, 18 Feb 2023 11:41:56 -0800 Subject: [PATCH 28/36] Update joystick_controller.rst --- doc/example_code/how_to_examples/joystick_controller.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/example_code/how_to_examples/joystick_controller.rst b/doc/example_code/how_to_examples/joystick_controller.rst index 870308801..f442e7326 100644 --- a/doc/example_code/how_to_examples/joystick_controller.rst +++ b/doc/example_code/how_to_examples/joystick_controller.rst @@ -2,7 +2,7 @@ How to get connected controllers =================== -We can get a list of connected controllers by using :code:`arcade.get_joysticks()`. There might be multiple controllers in the list +We can get a list of connected controllers by using :code:`arcade.get_joysticks()`. .. code-block:: python From 03bba81f86f1538c3eef0c9f5f4edf2c56da619b Mon Sep 17 00:00:00 2001 From: JDLiang100 <86375529+JDLiang100@users.noreply.github.com> Date: Sat, 18 Feb 2023 11:46:35 -0800 Subject: [PATCH 29/36] Update joystick_controller.rst --- doc/example_code/how_to_examples/joystick_controller.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/example_code/how_to_examples/joystick_controller.rst b/doc/example_code/how_to_examples/joystick_controller.rst index f442e7326..e61798afa 100644 --- a/doc/example_code/how_to_examples/joystick_controller.rst +++ b/doc/example_code/how_to_examples/joystick_controller.rst @@ -16,6 +16,8 @@ We can get a list of connected controllers by using :code:`arcade.get_joysticks( Joystick Values ================ +The hoystick values can be obtained by using :code:`self.joystick.x` and :code:`self.joystick.y` + How to use buttons =================== How to use hatHow to use ranged triggers (like for acceleration) From db9def63292cdcd9fd1760f97608181dd91309ce Mon Sep 17 00:00:00 2001 From: JDLiang100 <86375529+JDLiang100@users.noreply.github.com> Date: Sat, 18 Feb 2023 11:46:47 -0800 Subject: [PATCH 30/36] Update joystick_controller.rst --- doc/example_code/how_to_examples/joystick_controller.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/example_code/how_to_examples/joystick_controller.rst b/doc/example_code/how_to_examples/joystick_controller.rst index e61798afa..5c00e365d 100644 --- a/doc/example_code/how_to_examples/joystick_controller.rst +++ b/doc/example_code/how_to_examples/joystick_controller.rst @@ -16,7 +16,7 @@ We can get a list of connected controllers by using :code:`arcade.get_joysticks( Joystick Values ================ -The hoystick values can be obtained by using :code:`self.joystick.x` and :code:`self.joystick.y` +The joystick values can be obtained by using :code:`self.joystick.x` and :code:`self.joystick.y` How to use buttons =================== From da688260cf3bef26c0945ec582749122ca735b67 Mon Sep 17 00:00:00 2001 From: JDLiang100 <86375529+JDLiang100@users.noreply.github.com> Date: Sat, 18 Feb 2023 11:52:04 -0800 Subject: [PATCH 31/36] Update joystick_controller.rst --- .../how_to_examples/joystick_controller.rst | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/example_code/how_to_examples/joystick_controller.rst b/doc/example_code/how_to_examples/joystick_controller.rst index 5c00e365d..4b2f81950 100644 --- a/doc/example_code/how_to_examples/joystick_controller.rst +++ b/doc/example_code/how_to_examples/joystick_controller.rst @@ -16,7 +16,15 @@ We can get a list of connected controllers by using :code:`arcade.get_joysticks( Joystick Values ================ -The joystick values can be obtained by using :code:`self.joystick.x` and :code:`self.joystick.y` +The joystick values can be obtained by using :code:`self.joystick.x` and :code:`self.joystick.y`. This can be used to update the current positon of an object. +def update(self, delta_time): +.. code-block:: python + # Update the position according to the game controller + if self.joystick: + print(self.joystick.x, self.joystick.y) + + self.object.change_x = self.joystick.x + self.object.change_y = -self.joystick.y How to use buttons =================== From 0123aa07afcde832855a4ba1aa1ec755837c7b94 Mon Sep 17 00:00:00 2001 From: JDLiang100 <86375529+JDLiang100@users.noreply.github.com> Date: Sat, 18 Feb 2023 11:52:18 -0800 Subject: [PATCH 32/36] Update joystick_controller.rst --- doc/example_code/how_to_examples/joystick_controller.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/example_code/how_to_examples/joystick_controller.rst b/doc/example_code/how_to_examples/joystick_controller.rst index 4b2f81950..55403f5e2 100644 --- a/doc/example_code/how_to_examples/joystick_controller.rst +++ b/doc/example_code/how_to_examples/joystick_controller.rst @@ -18,8 +18,8 @@ Joystick Values ================ The joystick values can be obtained by using :code:`self.joystick.x` and :code:`self.joystick.y`. This can be used to update the current positon of an object. def update(self, delta_time): + .. code-block:: python - # Update the position according to the game controller if self.joystick: print(self.joystick.x, self.joystick.y) From 3b109cecf0f603b9bb50192e5432e843a4ac4d0a Mon Sep 17 00:00:00 2001 From: JDLiang100 <86375529+JDLiang100@users.noreply.github.com> Date: Sat, 18 Feb 2023 11:52:47 -0800 Subject: [PATCH 33/36] Update joystick_controller.rst --- doc/example_code/how_to_examples/joystick_controller.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/example_code/how_to_examples/joystick_controller.rst b/doc/example_code/how_to_examples/joystick_controller.rst index 55403f5e2..53bc33d38 100644 --- a/doc/example_code/how_to_examples/joystick_controller.rst +++ b/doc/example_code/how_to_examples/joystick_controller.rst @@ -20,6 +20,8 @@ The joystick values can be obtained by using :code:`self.joystick.x` and :code:` def update(self, delta_time): .. code-block:: python + + # Update the position according to the game controller if self.joystick: print(self.joystick.x, self.joystick.y) From f700bec5ad889f7c5a9a0563454abc527efcc216 Mon Sep 17 00:00:00 2001 From: Michelle Tan Date: Sat, 18 Feb 2023 20:50:28 +0000 Subject: [PATCH 34/36] Update joystick_controller.rst --- .../how_to_examples/joystick_controller.rst | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/doc/example_code/how_to_examples/joystick_controller.rst b/doc/example_code/how_to_examples/joystick_controller.rst index 53bc33d38..ad710e57d 100644 --- a/doc/example_code/how_to_examples/joystick_controller.rst +++ b/doc/example_code/how_to_examples/joystick_controller.rst @@ -38,5 +38,37 @@ How the (-1.0 to 1.0) range works ================================== Deadzone ======== +A centered joystick might have a value not at 0, but at 0.0001 or some small number. This will make for a small “drift” on a person’s character. We often counteract this by having a “dead zone” where if the number is below a certain value, we just assume it is zero to eliminate the drift. + +how we take care of the dead zone: +After +.. code-block:: console + import arcade +add the following line: +.. code-block:: console + DEAD_ZONE = 0.02 + +adding the following code to the **update **: +.. code-block:: python + def update(self, delta_time): + + # Update the position according to the game controller + if self.joystick: + + # Set a "dead zone" to prevent drive from a centered joystick + if abs(self.joystick.x) < DEAD_ZONE: + self.ball.change_x = 0 + else: + self.ball.change_x = self.joystick.x * MOVEMENT_SPEED + + # Set a "dead zone" to prevent drive from a centered joystick + if abs(self.joystick.y) < DEAD_ZONE: + self.ball.change_y = 0 + else: + self.ball.change_y = -self.joystick.y * MOVEMENT_SPEED + + +we add the following lines: + How-To Example Code =================== From 784f8b111c3e8b547eabdd0692a68428e206735d Mon Sep 17 00:00:00 2001 From: Michelle Tan Date: Sat, 18 Feb 2023 21:30:13 +0000 Subject: [PATCH 35/36] Update joystick_controller.rst --- .../how_to_examples/joystick_controller.rst | 39 +++++++++++-------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/doc/example_code/how_to_examples/joystick_controller.rst b/doc/example_code/how_to_examples/joystick_controller.rst index ad710e57d..45f978fdd 100644 --- a/doc/example_code/how_to_examples/joystick_controller.rst +++ b/doc/example_code/how_to_examples/joystick_controller.rst @@ -40,35 +40,40 @@ Deadzone ======== A centered joystick might have a value not at 0, but at 0.0001 or some small number. This will make for a small “drift” on a person’s character. We often counteract this by having a “dead zone” where if the number is below a certain value, we just assume it is zero to eliminate the drift. -how we take care of the dead zone: +How we take care of the dead zone: After + .. code-block:: console + import arcade + add the following line: + .. code-block:: console + DEAD_ZONE = 0.02 -adding the following code to the **update **: -.. code-block:: python - def update(self, delta_time): - # Update the position according to the game controller - if self.joystick: +and adding the following code to the :code:`update`: - # Set a "dead zone" to prevent drive from a centered joystick - if abs(self.joystick.x) < DEAD_ZONE: - self.ball.change_x = 0 - else: - self.ball.change_x = self.joystick.x * MOVEMENT_SPEED +.. code-block:: python + + def update(self, delta_time): - # Set a "dead zone" to prevent drive from a centered joystick - if abs(self.joystick.y) < DEAD_ZONE: - self.ball.change_y = 0 - else: - self.ball.change_y = -self.joystick.y * MOVEMENT_SPEED + # Update the position according to the game controller + if self.joystick: + # Set a "dead zone" to prevent drive from a centered joystick + if abs(self.joystick.x) < DEAD_ZONE: + self.object.change_x = 0 + else: + self.object.change_x = self.joystick.x * MOVEMENT_SPEED -we add the following lines: + # Set a "dead zone" to prevent drive from a centered joystick + if abs(self.joystick.y) < DEAD_ZONE: + self.object.change_y = 0 + else: + self.object.change_y = -self.joystick.y * MOVEMENT_SPEED How-To Example Code =================== From a6326251c49337fac431a0e969633bc5b9bdd738 Mon Sep 17 00:00:00 2001 From: Michelle Tan Date: Sat, 18 Feb 2023 21:36:01 +0000 Subject: [PATCH 36/36] Update joystick_controller.rst --- doc/example_code/how_to_examples/joystick_controller.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/example_code/how_to_examples/joystick_controller.rst b/doc/example_code/how_to_examples/joystick_controller.rst index 45f978fdd..2df3c044c 100644 --- a/doc/example_code/how_to_examples/joystick_controller.rst +++ b/doc/example_code/how_to_examples/joystick_controller.rst @@ -41,6 +41,7 @@ Deadzone A centered joystick might have a value not at 0, but at 0.0001 or some small number. This will make for a small “drift” on a person’s character. We often counteract this by having a “dead zone” where if the number is below a certain value, we just assume it is zero to eliminate the drift. How we take care of the dead zone: + After .. code-block:: console