-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParasites.py
More file actions
37 lines (29 loc) · 703 Bytes
/
Copy pathParasites.py
File metadata and controls
37 lines (29 loc) · 703 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
import pygame
from pygame.locals import *
import numpy as np
from time import sleep
pygame.init()
w, h = 500, 500
screen = pygame.display.set_mode((w, h))
screensize = np.int32((w, h))
hosts = []
parasites = []
class Host:
def __init__(self, pos, speed):
self.pos = np.float32(pos)
self.speed = speed
self.ang = np.random
keys = set()
while True:
screen.fill(0)
pygame.display.flip()
for e in pygame.event.get():
if e.type == QUIT:
quit()
elif e.type == KEYDOWN:
keys.add(e.key)
if e.key == K_ESCAPE:
quit()
elif e.type == KEYUP:
keys.discard(e.key)
sleep(0.001)