-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
77 lines (53 loc) · 1.63 KB
/
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
from src.constantes import *
from src.classes.world import World
pygame.init()
pygame.display.set_caption('diep.io')
SCREEN.fill(BLACK())
if ON_FULLSCREEN:
pygame.display.toggle_fullscreen()
clock = pygame.time.Clock()
# -----+----- #
world = World()
my_tik = 0
# -----+----- #
while RUN:
clock.tick(FPS)
SCREEN.fill(WHITE(10))
pygame.display.set_caption(f'diep.io fps: {str(int(clock.get_fps()))}')
keys = pygame.key.get_pressed()
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
RUN = False
if event.type == pygame.MOUSEWHEEL:
world.scale_world(event.y/10)
if event.type == pygame.KEYUP:
if event.key == pygame.K_f :
SIZE_SCREEN = [1366, 768]
SCREEN = pygame.display.set_mode(SIZE_SCREEN)
pygame.display.toggle_fullscreen()
pass
if keys[pygame.K_ESCAPE]:
pygame.quit()
RUN = False
if keys[pygame.K_t] :
world.players[0].shot()
if keys[pygame.K_w]:
world.cam_pos[1] += 20
if keys[pygame.K_s]:
world.cam_pos[1] -= 20
if keys[pygame.K_a]:
world.cam_pos[0] += 20
if keys[pygame.K_d]:
world.cam_pos[0] -= 20
if keys[pygame.K_LEFT]:
world.players[0].player_move(-9, 0)
if keys[pygame.K_RIGHT]:
world.players[0].player_move(9, 0)
if keys[pygame.K_SPACE]:
world.players[0].player_move(0, 10)
if RUN == True:
world.draw_screen()
world.world_update(my_tik)
pygame.display.update()
my_tik += 1