-
Notifications
You must be signed in to change notification settings - Fork 0
/
weapons.py
79 lines (66 loc) · 2.27 KB
/
weapons.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
78
79
import pygame
import random
from blast import KnifeBlast, PistolBlast, Mp40Blast, TompsonBlast
from textures import img
from enums import Direction
from otherfunctions import rot_center
class Weapon(pygame.sprite.Sprite):
def __init__(self, x: int, y: int):
super().__init__()
self.rect = pygame.Rect((x, y), [20, 20])
self.image = None
self.mini = None
self.blast = None
self.plusammo = random.randrange(1, 16)
def drawmini(self, player, screen):
x = player.rect.x - 5
y = player.rect.y - 5
d = player.direction.value
g = self.mini
i = None
if d is Direction.LEWO.value:
i = rot_center(g, 90)
elif d is Direction.PRAWO.value:
i = rot_center(g, -90)
elif d is Direction.GORA.value:
i = rot_center(g, 0)
elif d is Direction.DOL.value:
i = rot_center(g, 180)
elif d is Direction.GORAPRAWO.value:
i = rot_center(g, -45)
elif d is Direction.GORALEWO.value:
i = rot_center(g, 45)
elif d is Direction.DOLLEWO.value:
i = rot_center(g, 135)
elif d is Direction.DOLPRAWO.value:
i = rot_center(g, -135)
screen.blit(i, (x, y))
class Knife(Weapon):
def __init__(self, x: int, y: int):
super().__init__(x, y)
self.image = img.knife
self.mini = img.knife_mini
self.square = img.knife_square
self.blast = KnifeBlast
self.plusammo = 40
class Pistol(Weapon):
def __init__(self, x: int, y: int):
super().__init__(x, y)
self.image = img.pistol
self.mini = img.pistol_mini
self.square = img.pistol_square
self.blast = PistolBlast
class Mp40(Weapon):
def __init__(self, x: int, y: int):
super().__init__(x, y)
self.image = img.mp40
self.mini = img.mp40_mini
self.square = img.mp40_square
self.blast = Mp40Blast
class Tompson(Weapon):
def __init__(self, x: int, y: int):
super().__init__(x, y)
self.image = img.tompson
self.mini = img.tompson_mini
self.square = img.tompson_square
self.blast = TompsonBlast