-
Notifications
You must be signed in to change notification settings - Fork 1
/
player.py
48 lines (41 loc) · 1.19 KB
/
player.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
from arcade import Sprite
from arcade import load_texture
PLAYER_SCALE = 0.45
class Player(Sprite):
def __init__(self, ID, name, team, pos):
if team == 0:
file = 'res\Players\Cop'
else:
file = 'res\Players\Theif'
super().__init__(file + "U.png")
self.file = file + "D.png"
self.scale = PLAYER_SCALE
self.id = ID
self.name = name
self.team = team
self.position = pos
self.angle = 0
self.status = 1
self.life = 1
self.items = []
self.cur_item = -1
self.jailed = False
def update(self):
if self.change_y > 0:
self.angle = 0
elif self.change_y < 0:
self.angle = 180
elif self.change_x > 0:
self.angle = 270
elif self.change_x < 0:
self.angle = 90
self.center_x += self.change_x
self.center_y += self.change_y
def send_to_jail(self):
pos = {0: (940, 755), 1: (75, 755)}
self.life = 0
self.change_x, self.change_y = 0, 0
self.items = []
self.cur_item = -1
self.jailed = True
self.position = pos[self.team]