summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Gayot <olivier.gayot@sigexec.com>2021-11-12 14:20:51 +0100
committerOlivier Gayot <olivier.gayot@sigexec.com>2021-11-12 14:33:32 +0100
commit71ff729b4d42a28d300c62ac4b436d8143e6a8cc (patch)
treee2e81b840a1802c76f5a7abb0f258fcab1e63d9f
parent8f82ba5acd095b78fcec9d63f2977c04c778f02b (diff)
Remove trailing newlines and add blank lines were needed
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
-rw-r--r--cameltris/controller.py1
-rw-r--r--cameltris/misc.py2
-rw-r--r--cameltris/screens/in_game.py3
-rw-r--r--cameltris/screens/pause.py1
-rw-r--r--cameltris/screens/screen.py1
5 files changed, 3 insertions, 5 deletions
diff --git a/cameltris/controller.py b/cameltris/controller.py
index 86f5bcb..a1abf05 100644
--- a/cameltris/controller.py
+++ b/cameltris/controller.py
@@ -56,7 +56,6 @@ class JoystickController(Controller):
def is_pressed(self, input_: Input):
return self.joystick.get_button(self.mapping[input_].value)
-
def get_input_down(self, event):
for key, value in self.mapping.items():
if value.value == event.button:
diff --git a/cameltris/misc.py b/cameltris/misc.py
index 11c2358..8960e4b 100644
--- a/cameltris/misc.py
+++ b/cameltris/misc.py
@@ -1,6 +1,6 @@
class Pause(Exception):
pass
+
class UnPause(Exception):
pass
-
diff --git a/cameltris/screens/in_game.py b/cameltris/screens/in_game.py
index 242f683..5596ddb 100644
--- a/cameltris/screens/in_game.py
+++ b/cameltris/screens/in_game.py
@@ -15,6 +15,7 @@ from ..misc import Pause
class WouldCollide(Exception):
pass
+
class PlayerQuit(Exception):
pass
@@ -44,7 +45,6 @@ class Player:
self.score_canvas = pygame.Surface((296, 50))
self.level_canvas = pygame.Surface((296, 50))
-
def generate_piece(self) -> tuple[Piece, list[int]]:
# We may want to make this a function outside the class
piece = random.choice((TPiece, SPiece, IPiece, ZPiece, SquarePiece, LPiece, JPiece))()
@@ -234,6 +234,7 @@ class Player:
if element is not None:
self.grid_canvas.blit(element, ((col_idx + self.current_piece_position[1]) * 50 + 1, (row_idx + self.current_piece_position[0]) * 50 + 1))
+
def handle_input_pressed(instance, players: list[Player], event: pygame.event.Event) -> None:
for player in players:
if isinstance(player.controller, instance):
diff --git a/cameltris/screens/pause.py b/cameltris/screens/pause.py
index 2ea7849..99749f3 100644
--- a/cameltris/screens/pause.py
+++ b/cameltris/screens/pause.py
@@ -25,7 +25,6 @@ class Pause(Screen):
self.event_handler[pygame.JOYBUTTONDOWN] = lambda evt: handle_input_pressed(JoystickController(evt.joy), evt)
self.event_handler[pygame.KEYDOWN] = lambda evt: handle_input_pressed(KeyboardController(pygame.key), evt)
-
def refresh(self) -> None:
pass
diff --git a/cameltris/screens/screen.py b/cameltris/screens/screen.py
index 419c1d2..87c15f4 100644
--- a/cameltris/screens/screen.py
+++ b/cameltris/screens/screen.py
@@ -9,4 +9,3 @@ class Screen(abc.ABC):
@abc.abstractmethod
def oneframe(self) -> None:
pass
-