random crap
This commit is contained in:
parent
e9d20130c4
commit
b43a2b32b3
1 changed files with 4 additions and 3 deletions
7
game.py
7
game.py
|
@ -84,7 +84,6 @@ def play(window):
|
||||||
window.fill((0,0,0))
|
window.fill((0,0,0))
|
||||||
player_group.update()
|
player_group.update()
|
||||||
|
|
||||||
|
|
||||||
for event in pygame.event.get():
|
for event in pygame.event.get():
|
||||||
if event.type == pygame.QUIT:
|
if event.type == pygame.QUIT:
|
||||||
logging.critical("Exiting Game...")
|
logging.critical("Exiting Game...")
|
||||||
|
@ -109,17 +108,16 @@ def play(window):
|
||||||
temp = Bullet(player)
|
temp = Bullet(player)
|
||||||
bullet_group.add(temp)
|
bullet_group.add(temp)
|
||||||
|
|
||||||
|
|
||||||
for sprite in bullet_group:
|
for sprite in bullet_group:
|
||||||
if not sprite.at_bound():
|
if not sprite.at_bound():
|
||||||
sprite.update()
|
sprite.update()
|
||||||
if sprite.rect.y < 0 or sprite.rect.y > player.rect.y:
|
if sprite.rect.y < 0 or sprite.rect.y > player.rect.y:
|
||||||
bullet_group.remove(sprite)
|
bullet_group.remove(sprite)
|
||||||
|
|
||||||
|
|
||||||
for bullet in bullet_group:
|
for bullet in bullet_group:
|
||||||
hit_list = pygame.sprite.spritecollide(bullet, target_group, True)
|
hit_list = pygame.sprite.spritecollide(bullet, target_group, True)
|
||||||
for target in hit_list:
|
for target in hit_list:
|
||||||
|
if bullet.type == "TARGET": continue
|
||||||
target_group.remove(target)
|
target_group.remove(target)
|
||||||
bullet_group.remove(bullet)
|
bullet_group.remove(bullet)
|
||||||
logging.info("Hit Target!")
|
logging.info("Hit Target!")
|
||||||
|
@ -165,14 +163,17 @@ def play(window):
|
||||||
|
|
||||||
update_score(window, player.score)
|
update_score(window, player.score)
|
||||||
update_level(window, player.level)
|
update_level(window, player.level)
|
||||||
|
|
||||||
player_group.update()
|
player_group.update()
|
||||||
bullet_group.draw(window)
|
bullet_group.draw(window)
|
||||||
target_group.draw(window)
|
target_group.draw(window)
|
||||||
player_group.draw(window)
|
player_group.draw(window)
|
||||||
pygame.display.update()
|
pygame.display.update()
|
||||||
|
|
||||||
target_movement_timeout -= 1
|
target_movement_timeout -= 1
|
||||||
clock.tick(FPS)
|
clock.tick(FPS)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
logging.basicConfig(format="%(levelname)s:%(message)s", level=logging.DEBUG)
|
logging.basicConfig(format="%(levelname)s:%(message)s", level=logging.DEBUG)
|
||||||
initialise(None, None)
|
initialise(None, None)
|
||||||
|
|
Reference in a new issue