-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathunmove.py
68 lines (49 loc) · 1.99 KB
/
unmove.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
import pygame
from math import sqrt
class game_object:
def __init__(self, x, y):
self.x = x
self.y = y
def draw(self, win):
win.blit(self.image, (self.x, self.y))
def dist(self, target_x, target_y):
dx = target_x - self.x
dy = target_y - self.y
return sqrt(dx ** 2 + dy ** 2)
def pos_bg(self, vel_x, vel_y):
self.x += vel_x
self.y += vel_y
class Artifact(game_object):
def __init__(self, x, y, image_path):
super().__init__(x, y)
self.image = pygame.image.load(image_path)
self.image = pygame.transform.scale(self.image, (50, 50))
class Armor(game_object):
def __init__(self, x, y, image_path, protection, strength):
super().__init__(x, y)
self.image = pygame.image.load(image_path)
self.image = pygame.transform.scale(self.image, (50, 50))
self.protection = protection
self.strength = strength
def get_char(self):
return {'protection': self.protection, 'strength': self.strength}
class Weapon(game_object):
def __init__(self, x, y, image, rang, damage):
super().__init__(x, y)
self.image = pygame.image.load(weapon_image[image])
self.image = pygame.transform.scale(self.image, (50, 50))
self.rang, self.damage = rang, damage
self.image_path = weapon_image[image]
def get_char(self):
return {'rang': self.rang, 'attack': self.damage, 'image': self.image_path, 'path' : pygame.transform.scale(self.image, (50, 50))}
class Scales(game_object):
def __init__(self, x, y, image_path):
super().__init__(x, y)
self.image = pygame.image.load(image_path)
self.image = pygame.transform.scale(self.image, (50, 50))
class Smiths(game_object):
def __init__(self, x, y, image):
super().__init__(x, y)
self.image = pygame.image.load(image)
self.image = pygame.transform.scale(self.image, (180, 140))
weapon_image = ['меч_1.png', 'меч_большой.png']