avocados/game.py

44 lines
855 B
Python
Raw Normal View History

2014-08-30 15:28:07 +02:00
#!/usr/bin/env python3
"""
Avocados and stuff
"""
import os, random
import pygame
from pygame.locals import *
2014-08-30 15:28:07 +02:00
from support import colors
from interface import hud
2014-08-30 15:28:07 +02:00
# Move this outside
screen_width = 800
screen_height = 600
screen = pygame.display.set_mode((screen_width,screen_height))
bg = (0,0,0)
screen.fill(bg)
2014-08-30 15:28:07 +02:00
def main():
pygame.init()
pygame.display.set_caption('Avocados')
clock = pygame.time.Clock()
2014-08-30 16:06:02 +02:00
score = 0
time = 33
2014-08-30 15:28:07 +02:00
running = True
2014-08-30 15:28:07 +02:00
while running:
# Limit to 50 fps
time_passed = clock.tick(30)
2014-08-30 16:06:02 +02:00
fps = clock.get_fps()
my_hud = hud.draw_hud(score, time, fps)
screen.blit(my_hud, (10,10))
2014-08-30 15:28:07 +02:00
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
pygame.display.flip()
if __name__ == '__main__':
main()