-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathitems.py
106 lines (91 loc) · 4.27 KB
/
items.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import pygame
import player
import button
class Bones(pygame.sprite.Sprite):
def __init__(self, count, x, y):
super().__init__()
self.name = "Bone"
self.count = count
self.x = x
self.y = y
original_image = pygame.image.load("images/bonesv4.png").convert_alpha()
self.image = pygame.transform.scale(original_image, (150, 150))
self.rect = self.image.get_rect(topleft=(x, y))
self.mask = pygame.mask.from_surface(self.image)
self.opened_in_inven = False
self.sold = False
self.visible = False
def display_stats(self, surface):
big_font = pygame.font.SysFont("arial", 40)
fonts = pygame.font.SysFont("arial", 20)
name_display = big_font.render(f'{self.name}', True, (255, 255, 255))
stats_display = big_font.render(f'Stats:', True, (255, 255, 255))
count_display = fonts.render(f'Count: {self.count}', True, (255, 255, 255))
x_display = fonts.render(f'X: {self.x}', True, (255, 255, 255))
y_display = fonts.render(f'Y: {self.y}', True, (255, 255, 255))
pygame.draw.rect(surface, (210, 180, 140), (750, 300, 400, 500))
pygame.draw.rect(surface, (0, 0, 0), (750, 300, 400, 500), 2)
image = pygame.transform.scale(self.image, (400, 400))
#Displays stats
surface.blit(image, (750, 250))
surface.blit(name_display, (900, 300))
surface.blit(stats_display, (900, 550))
surface.blit(count_display, (770, 600))
surface.blit(x_display, (770, 630))
surface.blit(y_display, (770, 660))
#Create button images and then buttons
sell_image = pygame.image.load("images/Sell_button.png").convert_alpha()
drop_image = pygame.image.load("images/Drop_Button.png").convert_alpha()
sell_button = button.Button(770, 690, sell_image, 3.50)
drop_button = button.Button(880, 690, sell_image, 3.50)
merge_button = button.Button(990, 690, sell_image, 3.50)
#initalize buttons
s = sell_button.draw(surface)
d = drop_button.draw(surface)
m = merge_button.draw(surface)
if s:
self.sold = True
class Shiny_Rocks(pygame.sprite.Sprite):
def __init__(self, count, x, y):
super().__init__()
self.name = "Bone"
self.count = count
self.x = x
self.y = y
original_image = pygame.image.load("images/bonesv4.png").convert_alpha()
self.image = pygame.transform.scale(original_image, (150, 150))
self.rect = self.image.get_rect(topleft=(x, y))
self.mask = pygame.mask.from_surface(self.image)
self.opened_in_inven = False
self.sold = False
self.visible = False
def display_stats(self, surface):
big_font = pygame.font.SysFont("arial", 40)
fonts = pygame.font.SysFont("arial", 20)
name_display = big_font.render(f'{self.name}', True, (255, 255, 255))
stats_display = big_font.render(f'Stats:', True, (255, 255, 255))
count_display = fonts.render(f'Count: {self.count}', True, (255, 255, 255))
x_display = fonts.render(f'X: {self.x}', True, (255, 255, 255))
y_display = fonts.render(f'Y: {self.y}', True, (255, 255, 255))
pygame.draw.rect(surface, (210, 180, 140), (750, 300, 400, 500))
pygame.draw.rect(surface, (0, 0, 0), (750, 300, 400, 500), 2)
image = pygame.transform.scale(self.image, (400, 400))
#Displays stats
surface.blit(image, (750, 250))
surface.blit(name_display, (900, 300))
surface.blit(stats_display, (900, 550))
surface.blit(count_display, (770, 600))
surface.blit(x_display, (770, 630))
surface.blit(y_display, (770, 660))
#Create button images and then buttons
sell_image = pygame.image.load("images/Sell_button.png").convert_alpha()
drop_image = pygame.image.load("images/Drop_Button.png").convert_alpha()
sell_button = button.Button(770, 690, sell_image, 3.50)
drop_button = button.Button(880, 690, sell_image, 3.50)
merge_button = button.Button(990, 690, sell_image, 3.50)
#initalize buttons
s = sell_button.draw(surface)
d = drop_button.draw(surface)
m = merge_button.draw(surface)
if s:
self.sold = True