From 88d1af12923c66f51ed84d7ed570322335080efa Mon Sep 17 00:00:00 2001 From: Diego Ramirez Date: Fri, 30 Aug 2024 18:42:25 -0600 Subject: [PATCH] Upgrade dependencies and remove some superflous comments --- main.py | 2 +- requirements.txt | 2 +- src/__init__.py | 2 +- src/characters.py | 10 +--------- src/levels.py | 9 ++++----- src/menu.py | 4 +--- src/scenes.py | 4 ++-- src/tools.py | 1 - test-requirements.txt | 2 +- 9 files changed, 12 insertions(+), 24 deletions(-) diff --git a/main.py b/main.py index 50f16e8..72f131e 100644 --- a/main.py +++ b/main.py @@ -57,5 +57,5 @@ def draw(self): if __name__ == "__main__": pyxel.init(128, 144, title="Diddi and Eli", capture_sec=120) - # pyxel.fullscreen(True) # why not? :P + # pyxel.fullscreen(True) Main() diff --git a/requirements.txt b/requirements.txt index a084c08..5d5dde9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -pyxel==2.1.9 \ No newline at end of file +pyxel==2.2.0 \ No newline at end of file diff --git a/src/__init__.py b/src/__init__.py index 5b4dbe6..bf9dfe8 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -4,7 +4,7 @@ __all__ = "stages_list" -# Below there's a dictionary with all the objects for further use +# A dictionary with all the objects for further use stages_list = { "intro": scenes.Intro, "one": levels.One, diff --git a/src/characters.py b/src/characters.py index ab82500..c004d89 100644 --- a/src/characters.py +++ b/src/characters.py @@ -67,7 +67,6 @@ def adjust_x(real_x): def get_tile(tile_x, tile_y): - # print(tile_x, tile_y) return pyxel.tilemaps[1].pget(tile_x, tile_y) @@ -212,7 +211,6 @@ def update(self): # NOTE: Why not putting 'self.check_bullets' after this block? # Well, what if, during multiplayer mode, one of the character # shoots a bullet and dies before such bullets finish their journey? - # TODO: Reconsider the above statement?? return global scroll_x self.prev_y = self.y @@ -234,7 +232,7 @@ def update(self): self.dy = min(self.dy + 1, 3) if pyxel.btnp(self.key_up) and not self.is_falling and not self.already_jumping: # Jump (instead of the fly-ish mechanics from previous games) - self.dy = -8 # TODO: Adjust this in order to achieve realistic jumps + self.dy = -8 self.already_jumping = True # Now operate the movement self.x, self.y, self.dx, self.dy = push_back(self.x, self.y, self.dx, self.dy) @@ -484,7 +482,6 @@ def __init__(self, x, y): self.alive = True def update(self): - # We won't do anything at all here! pass def draw(self): @@ -632,7 +629,6 @@ def spawn(self, left_x, right_x): for x in range(left_x, right_x + 1): for y in range(int(self.draw_v / 8), int(self.draw_v / 8) + 16): key = f"{x*8} {y*8}" - # print(key) if key in self.already_spawned: continue if key in self.enemy_template.keys(): @@ -660,9 +656,6 @@ def spawn(self, left_x, right_x): def generate_clouds(self, right_x): if not self.gen_clouds or random.randint(0, self.cloud_freq) != 1: return - # if (right_x in range(self.already_spawned_cloud+1, self.already_spawned_cloud+16)): - # print("condition b") - # return draw_comb = random.choice(self.acceptable_clouds) selected_y = random.randint(self.draw_v, self.draw_v + 90) self.clouds.append(Cloud(right_x, selected_y, draw_comb[0], draw_comb[1])) @@ -686,7 +679,6 @@ def update_template(self): "Some update actions that should happen in (almost) every instance." global TOTAL_COINS for i in self.clouds: - # this is a rutinary task, so we don't need to give it conditions. i.update() for p in self.player: p.update() diff --git a/src/levels.py b/src/levels.py index 8d1d43e..03db24f 100644 --- a/src/levels.py +++ b/src/levels.py @@ -83,9 +83,8 @@ class One(BaseLevel): ] ending_button = Button(1064, 96) finished_next = "two" - # this is a workaround to - # NOTE: The same workaround is present in all the levels stored here... - # TODO: Safely remove this workaround at some point? + # This is a workaround to , + # and the same workaround is present in all the levels here... nextlevel = "two" use_gradient = True gradient_height = 16 @@ -157,7 +156,7 @@ class Two(BaseLevel): "1008 160", ] bgcolor = 5 - acceptable_clouds = [(16, 16)] # Only one kind of clouds + acceptable_clouds = [(16, 16)] ending_button = Button(1192, 192) finished_next = "three" nextlevel = "three" @@ -378,7 +377,7 @@ class Five(BaseLevel): enemy_template = dict() coin_template = [] bgcolor = 0 # Using black just once - acceptable_clouds = [(32, 0)] # indeed, we don't want clouds here + acceptable_clouds = [(32, 0)] finished_next = "final" nextlevel = "final" use_gradient = True diff --git a/src/menu.py b/src/menu.py index ce4e541..34d9ef4 100644 --- a/src/menu.py +++ b/src/menu.py @@ -17,13 +17,11 @@ class Menu(BaseLevel): 2: "[3] Multiplayer", } music_vol = 5 - # reset_coin_counter = True gen_clouds = False saved_available = False def __init__(self, player_choice=None): BaseLevel.__init__(self, player_choice) - # and here comes the funny part: get and save level data self.update_saved_stage() def update_saved_stage(self): @@ -73,7 +71,7 @@ def draw(self): "Pyxel-like 'draw' function." # Clear the screen pyxel.cls(0) - pyxel.camera(0, self.draw_v) # TODO: Is this a good idea? + pyxel.camera(0, self.draw_v) # NOTE: Tilemap 0 is the menu tilemap, ok? pyxel.bltm(0, 0, 0, 0, 0, 128, 128) # Draw a "menu window" diff --git a/src/scenes.py b/src/scenes.py index af6aa67..6ccf5e8 100644 --- a/src/scenes.py +++ b/src/scenes.py @@ -42,7 +42,7 @@ def __init__(self, player_choice): BaseLevel.__init__(self, player_choice) def create_characters(self): - # NOTE: No Player classes, please! + # no Player classes, please! pass def update(self): @@ -83,7 +83,7 @@ class DeathSequence(BaseLevel): def __init__(self, player_choice): self.player_choice = player_choice - pyxel.camera(0, 0) # NOTE: draw_v is not needed here + pyxel.camera(0, 0) # draw_v is not needed here pyxel.stop() def update(self): diff --git a/src/tools.py b/src/tools.py index 0d25a3c..1fa6e84 100644 --- a/src/tools.py +++ b/src/tools.py @@ -5,7 +5,6 @@ import pyxel POSSIBLE_LEVELS = ( - # a list of allowed level names. # NOTE: "menu" or "death" should not be allowed as a saved level. "intro", "one", diff --git a/test-requirements.txt b/test-requirements.txt index a28ba82..bcaa2e1 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1 +1 @@ -ruff==0.6.0 \ No newline at end of file +ruff==0.6.3 \ No newline at end of file