-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
39 lines (31 loc) · 946 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import pygame
from constants import *
from player import Player
def main():
pygame.init()
fps = pygame.time.Clock()
dt= 0
screen =pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
color = (0, 0, 0)
player = Player(SCREEN_WIDTH/2,SCREEN_HEIGHT/2)
updatable = pygame.sprite.Group()
drawable = pygame.sprite.Group()
updatable.add(player)
drawable.add(player)
while True:
screen.fill(color)
for thing in updatable:
thing.update(dt)
for thing in drawable:
thing.draw(screen)
pygame.display.flip()
for event in pygame.event.get():
if event.type == pygame.QUIT:
return
# Limits framerate to 60 FPS
dt = fps.tick(60) / 1000
print("Starting asteroids!")
print("Screen width:", SCREEN_WIDTH)
print("Screen height:", SCREEN_HEIGHT)
if __name__ == "__main__":
main()