Skip to content
Browse files

added score, increments every time pick up robot

  • Loading branch information...
1 parent 57860f1 commit 7204e7915595c391d403f5f8a2a5f5202d0b0887 @jlevey3 committed
Showing with 7 additions and 2 deletions.
  1. +7 −2 files/main.py
View
9 files/main.py
@@ -23,6 +23,8 @@ def main():
robot = Robot(bounds.bottomleft, bounds)
player_grp = GroupSingle(player)
robot_grp = GroupSingle(robot)
+ score = 0
+ font = pygame.font.Font(None,35)
#game loop
done = False
@@ -43,6 +45,7 @@ def main():
else:
for robot in groupcollide(robot_grp, player_grp, False, False):
player.grab(robot)
+ score += 5
print "robot picked up"
break
@@ -62,10 +65,12 @@ def main():
screen.fill(BG_COLOR)
player_grp.draw(screen)
robot_grp.draw(screen)
- pygame.display.flip()
+
clock.tick(30)
-
+ score_text = font.render("Score: %05d"%score, False, (255,255,255))
+ screen.blit(score_text, (5,5))
+ pygame.display.flip()
if __name__ == "__main__":

0 comments on commit 7204e79

Please sign in to comment.
Something went wrong with that request. Please try again.