-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
44 lines (31 loc) · 966 Bytes
/
main.py
File metadata and controls
44 lines (31 loc) · 966 Bytes
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
40
41
42
43
44
import pygame
import random
from math import pi
from Objects import Circles
from Collision import Collsion
import setting as s
GameQuit = False
FPS = 60
clock = pygame.time.Clock()
pygame.init()
pygame.display.set_caption("Physics Engine")
screen = pygame.display.set_mode((s.WIDTH,s.HEIGHT))
screen.fill((255,255,255))
col = Collsion()
for i in range(10):
col.object_list.append(Circles(screen,random.randrange(20,50),random.randrange(10,1000),random.randrange(100,500),random.randrange(100,500)))
col.object_list[i].velx = random.random()*10
col.object_list[i].vely = random.random()*10
while not GameQuit:
for event in pygame.event.get():
if event.type == pygame.QUIT:
GameQuit = True
for i in col.object_list:
i.update()
col.collide_all()
col.collide_wall()
for i in col.object_list:
i.view()
pygame.display.flip()
screen.fill((255,255,255))
clock.tick(FPS)