Skip to content
This repository has been archived by the owner on Feb 18, 2025. It is now read-only.

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Virashu committed Feb 13, 2024
1 parent f2c5698 commit fb775a4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions danmaku/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,7 @@ def update_game(self):
self.background_object.animate()

if len(self.enemies) == 0:
if len(LEVELS) > self.cur_level + 1:
self.cur_level += 1
self.enemies = list(LEVELS[self.cur_level])
else:
set_saved_game(self.cur_level, self.player.score, self.player.power)
self.exit_status = "win"
self.stop()
self.next_level()

if self.player.health <= 0:
set_saved_game(self.cur_level, self.player.score, self.player.power)
Expand All @@ -247,6 +241,16 @@ def update_game(self):
pygame.time.wait(10)
self.stop()

def next_level(self) -> None:
"""Start next level if possible"""
if len(LEVELS) > self.cur_level + 1:
self.cur_level += 1
self.enemies = list(LEVELS[self.cur_level])
else:
set_saved_game(self.cur_level, self.player.score, self.player.power)
self.exit_status = "win"
self.stop()

def update(self):
# self.print_stats()
if Keys.ESCAPE in self.pressed_keys:
Expand Down
Empty file added danmaku/level.py
Empty file.

0 comments on commit fb775a4

Please sign in to comment.