summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcameltris.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/cameltris.py b/cameltris.py
index 7669dcf..8ece28d 100755
--- a/cameltris.py
+++ b/cameltris.py
@@ -1,5 +1,6 @@
#!/usr/bin/env python3
+import argparse
import contextlib
import enum
import random
@@ -318,6 +319,15 @@ def stick_piece():
next_piece, next_piece_position = generate_piece()
refresh_piece_preview_canvas()
+PARSER = argparse.ArgumentParser()
+
+PARSER.add_argument("--starting-level", type=int, choices=list(range(1, 30)), default=1)
+PARSER.add_argument("--joystick", type=int, dest="joystick_id", metavar="Joystick ID")
+
+ARGS = vars(PARSER.parse_args())
+
+print(ARGS)
+
pygame.init()
black = (0, 0, 0)
@@ -364,10 +374,9 @@ das = 0
pressing_down_countdown = None
-joysticks = [pygame.joystick.Joystick(x) for x in range(pygame.joystick.get_count())]
-for joystick in joysticks:
+if ARGS["joystick_id"] is not None:
+ joystick = pygame.joystick.Joystick(ARGS["joystick_id"])
joystick.init()
-joystick = joysticks[0]
while True:
piece_drop_frames += 1