Skip to content

Commit b998603

Browse files
committed
pep8, fix joystick action vs direction bug
1 parent 2018604 commit b998603

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

joystick.py renamed to Joystick.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import pygame
55

66

7-
class joystick(object):
7+
class Joystick(object):
88
def __init__(self):
99
self.joystick_names = []
1010
self.doMove = -1
@@ -52,7 +52,7 @@ def getAction(self):
5252
someJoyButtonDown = True
5353
self.joyButtonDown = someJoyButtonDown
5454

55-
if self.doMove != -1:
55+
if self.doMove != -1 and not action:
5656
action = "move"
5757

5858
except Exception as ex:

‎snake.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
import conf
1515
from ui import ui
16-
from joystick import joystick
16+
from Joystick import Joystick
1717
from popUp import popUp
1818
from touchScreen import touchScreen
1919

@@ -256,7 +256,7 @@ def run_game(self):
256256
self.touchScreen = touchScreen(self.SCREEN_WIDTH, self.SCREEN_HEIGHT)
257257

258258
pygame.joystick.init()
259-
self.joystickInteract = joystick()
259+
self.joystickInteract = Joystick()
260260

261261
keymap = {
262262
pygame.K_UP: 1,

0 commit comments

Comments
 (0)