Skip to content

Commit

Permalink
create enemies inside screen
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhishek10351 committed Jun 28, 2023
1 parent ef70a27 commit deed847
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion game/views/level.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def create_enemies(self, enemy_instance, enemy_path,
enemy_x_change = list(range(-5, 5))
enemy_x_change.remove(0)
enemy.change_x = random.choice(enemy_x_change)
if not enemy.collides_with_list(self.enemy_list) or enemy.left > 0:
if enemy.left > 0 and enemy.right<SCREEN_WIDTH:
total += 1
self.enemy_list.append(enemy)

Expand Down Expand Up @@ -317,3 +317,5 @@ def highscore(self, new_highscore):
if new_highscore > self.highscore:
execute("UPDATE levels SET high_score = (?) WHERE level = (?)",
new_highscore, self.window.current_level)

# ! red powerup

0 comments on commit deed847

Please sign in to comment.