Commit cc5ea092 authored by Julian Rudolf's avatar Julian Rudolf
Browse files

removed bombs

parent dc559f13
......@@ -116,7 +116,7 @@ snake_length = 15
tmp_snake_length = 15
apples = [(set([]), green_apple), (set([]), purple_apple)]
bombs = [(set([]), bomb_img)]
#bombs = [(set([]), bomb_img)]
overall_score = [0, 0]
......@@ -193,15 +193,15 @@ class Snake:
a.remove(apple)
a.add(gen_rand_apple(img))
self.score += 1
for b, img in bombs:
for bomb in b:
if self.pos[0] > bomb.pos[0] and self.pos[0] < bomb.pos[0] + apple_size or \
self.pos[0] + block_size > bomb.pos[0] and self.pos[0] < bomb.pos[0] + apple_size:
if self.pos[1] > bomb.pos[1] and self.pos[1] < bomb.pos[1] + apple_size or \
self.pos[1] + block_size > bomb.pos[1] and self.pos[1] < bomb.pos[1] + apple_size:
b.remove(bomb)
b.add(gen_rand_apple(img))
self.score -= 2 if self.score >= 2 else 0
# for b, img in bombs:
# for bomb in b:
# if self.pos[0] > bomb.pos[0] and self.pos[0] < bomb.pos[0] + apple_size or \
# self.pos[0] + block_size > bomb.pos[0] and self.pos[0] < bomb.pos[0] + apple_size:
# if self.pos[1] > bomb.pos[1] and self.pos[1] < bomb.pos[1] + apple_size or \
# self.pos[1] + block_size > bomb.pos[1] and self.pos[1] < bomb.pos[1] + apple_size:
# b.remove(bomb)
# b.add(gen_rand_apple(img))
# self.score -= 2 if self.score >= 2 else 0
# turn in the corresponding direction
def turn_right(self):
......@@ -710,8 +710,8 @@ def button(text, pos, color1, color2, action, text_color=black):
# pause screen
def pause():
paused = True
message_screen("Paused", black, -100, "large")
message_screen("Press Space to continue or Escape to quit", black, 25)
#message_screen("Paused", black, -100, "large")
#message_screen("Press Space to continue or Escape to quit", black, 25)
pygame.display.update()
while paused:
for event in pygame.event.get():
......@@ -1020,10 +1020,10 @@ def game_loop():
while apple_count > len(a):
apple = gen_rand_apple(img)
a.add(apple)
for b, img in bombs:
while bomb_count > len(b):
bomb = gen_rand_apple(img)
b.add(bomb)
# for b, img in bombs:
# while bomb_count > len(b):
# bomb = gen_rand_apple(img)
# b.add(bomb)
# initialize shield
init_shield(map_filename)
......@@ -1158,21 +1158,21 @@ def game_loop():
playerwin = 2
# change position of the bomb after bomb_switch_time
if pygame.time.get_ticks() - time >= bomb_switch_time:
time = pygame.time.get_ticks()
for b, img in bombs:
b.clear()
while bomb_count > len(b):
bomb = gen_rand_apple(img)
b.add(bomb)
# if pygame.time.get_ticks() - time >= bomb_switch_time:
# time = pygame.time.get_ticks()
# for b, img in bombs:
# b.clear()
# while bomb_count > len(b):
# bomb = gen_rand_apple(img)
# b.add(bomb)
# draw apples and bombs
for a, img in apples:
for apple in a:
apple.draw()
for b, img in bombs:
for bomb in b:
bomb.draw()
# for b, img in bombs:
# for bomb in b:
# bomb.draw()
pygame.display.update()
clock.tick(FPS)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment